#nested async awaits; How to return?

10 messages · Page 1 of 1 (latest)

misty girder
#

const [currentUserResource] = createResource(getData)

#

your getData should just return currentUser

#

if you want both to be returned you can return an object

return {currentUser, currentProfile}
#

then in the jsx you would access via currentUserResource().currentUser or currentUserResource().currentProfile

woven sable
#

You must be thirsty today.

#

Oh, so one Resource can hold both datasets. Nice.

#

Guess I didn't read all the way through Chat's answer, as I was distracted by the (!response1.ok) (would .ok work instead of .error)

woven sable
#

In my getData() does anyone see recursion? Im' getting an error in the console (not affecting the rendering or functionality of the page as far as I can tell). I'm guessing the function as the error says Uncaught (in promise) InternalError: too much recursion and that's the only place I have a promise in this component. Thanks again.

hexed canyon
#

This is probably due to us misusing solid in some way