#Hi guys i have got an interesting problem. when I am making a req from action for the first the load

1 messages · Page 1 of 1 (latest)

devout violet
#

Hi guys i have got an interesting problem. when I am making a req from action for the first the loader are recieving null in the cookies and after making another request than the loader started to getting previous values. keeping the ui always unupdated. as it is recieving the preivous state value. how can i figure this out. here is my code.

lavish granite
#

what's the cookie configuration?

#

when you call createCookie

devout violet
#

it is default

#

didnt changed anything

#

@lavish granite

devout violet
#

?

#

export const userPrefs = createCookie("user-prefs", {
  maxAge: 604_800, // one week
});
#

here is the cookie config i m using

lavish granite
#

if you're not receiving the cookie then it can be because either the Cookie object can't parse it (maybe it was created by another tool? Remix cookies expects them to be JSON.stringified, signed and base64 encoded), or because the browser sent no cookies at all

devout violet
#

if that is the case then how the cookies are getting recieved once the action is ran again

#

dont know why for the first time it is not running

lavish granite
#

try to check the devtools to see if you're getting the cookie header with your cookie

#

if you can't find it try to create a reproduction repo or a codesandbox

devout violet
#

Ok

devout violet
#

@lavish granite so the real problem was that i was not using incorrect config but i was not using redirect in the action return

#

But I am thinking doesnt that reloads the page.