Wappler Cookie Manager shows wrong cookies

Wappler Version : 6.6.0
Operating System : Windows 10
Server Model: NoseJS
Database Type: MySQL
Hosting Type: Docker/Digital Ocean

Expected behavior

I want my browser cookie to match the cookies that appconnect is using in realtime.

Actual behavior

What actually happens?

It is showing me old cookie values that don't match my newly set cookie values, the server action is setting the cookies properly, but the app connect cookie manager on the frontend is not updating them in real time?

How to reproduce

No idea

@George could this be looked into for the upcoming Thursday bug patch?

Cookies are obviously all allowed as they are being set correctly, both chrome and firefox show the correct cookies being set from the server action, but I have some actions of my frontend based on cookies being updated which they are not being updated in realtime or there is some sort of very long delay

I don’t see any cookie issues here, but rather wrong expectations…

You do know that cookies are send server side to new requests/pages only after being set, so not to current page. So that might be your problem.

So as long as I force a page refresh this will reload the cookie manager?

I can't say I've ever noticed this on the older wappler versions, I have quite a few sites doing things on cookie actions in realtime (I'll have to go see how I managed it)

You might be mis understanding me here, the server action is setting the cookie fine, I want the front-end page to react after the cookies is changed.

IE reading a cookie for a modal popup. I'm not trying to send the cookie back to the server

It looks quite realtime to me:

img-2

<dmx-cookie-manager id="cookies1"></dmx-cookie-manager>
    <div class="container">
        <div class="row">
            <div class="col">
                <h4>Cookie value: {{cookies1.data.mycookie}}</h4>
                <button class="btn btn-primary" dmx-on:click="cookies1.set('mycookie',0,{})">Set cookie to 0</button>
                <button class="btn btn-primary" dmx-on:click="cookies1.set('mycookie',1,{})">Set cookie to 1</button>
            </div>
        </div>
    </div>

So as per my screenshot why is the dynamic values set to the cookies not matching the browser cookie values? I don't understand why they dont match

Well in your browser dev tools you need to click the little refresh icon to see the updated value.

the cookies in my dev tool are the correct cookies, its the wappler dynamic value that is "wrong/old"

These values do not match my developer tool cookie values

How do you change these cookie values? Have you tried the code i posted?

This is setting the cookie value, the browser cookie's are being set to this value, but the value here.

cookie2

so why do these cookies mismatch? I don't understand

But you are setting the cookie on the server side, not using the cookie manager on your page…
These are different things. Check George’s reply once again. When you change your cookie on the server side, your page doesn’t know its value is changed unless you refresh the page.

Could I suggest a feature request for a update cookie action? This seems like it would make life a ton easier

Could you not have an on Success event fire when the Action is run, and reload the corresponding data back in to your page? This should send back the updated cookie in theory?

This would still not update the Client Side until the data is fetched. You can do all this Client side with the Cookie Manager therefore doing it server side sort of leaves you in the same position you are now, ie, you still have to retrieve the newly set cookie.

I will give the on success method a try tonight, its a bit of a weird flow because I'm trying to create a custom shipping rate for stripe and then pass it to the checkout with the cart data array and cookies seemed the most straightforward method for this :slight_smile:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.