30
Views
4
Comments
Solved
GetCookies and SetCookies
Question

Hi Guys!

I'll try to explain it here, as I can't share the project because it belongs to the company

I'm trying to use these two components, one to save information in the cookie string format and the other to check when this information is stored.

However, either he is not able to search for the information or he is not able to save the information below, follow the configuration I made. Would anyone know if anything is missing?



Solution

Hi @fabiano Pinto 

I was able to reproduce your problem; even though I don't know the reason, you could overcome it like this:

Instead of running the logic around the cookie (getCookie, If, and SetCookie) on the client side, try to create a server action containing this logic, and call only this one on your client action anyway it is not a good practice to call several server actions in one single client action).

As I said, I could reproduce this in my environment: Using the GetCookie and SetCookie inside the client action, after setting, I could not get the value. By changing to run completely on the server side, it worked as expected.


Hello @fabiano Pinto 

Is it possible to share at least the error you are getting?

right now I only see warning lines under the server actions which look like a warning about using multiple server actions inside a client action.


Hi @fabiano Pinto ,

are you able to debug? It is difficult to help without seeing the entire flow...

What is the value of the variable "BuscaCookie"? ... you are using it as the cookie name, not sure if this would work if its content is "" ...


No error occurs, it's just not saving this cookie, I've already passed the string, I've already passed it in full.

and in this case I use a local text variable.

@Mika Grootenboer, @Tiago Resende



Solution

Hi @fabiano Pinto 

I was able to reproduce your problem; even though I don't know the reason, you could overcome it like this:

Instead of running the logic around the cookie (getCookie, If, and SetCookie) on the client side, try to create a server action containing this logic, and call only this one on your client action anyway it is not a good practice to call several server actions in one single client action).

As I said, I could reproduce this in my environment: Using the GetCookie and SetCookie inside the client action, after setting, I could not get the value. By changing to run completely on the server side, it worked as expected.


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.