goinvo / staffplan_redux

1 stars 2 forks source link

New User Mgt: error on adding new user #336

Closed jsonin closed 1 week ago

jsonin commented 2 weeks ago
image

this happened after I just authenticated again...

fermion commented 2 weeks ago

What browser are you using? Are you using a single tab? Is it intermittent or does it happen every time you try to add someone?

fermion commented 2 weeks ago

@jsonin do you remember what you had just done previously, if anything?

fermion commented 2 weeks ago

I think this and other issues we've had with forms are related to disabling Turbo on forms in the app. I'm going to spend some time refactoring these so that they use Turbo properly which should fix the issue.

fermion commented 2 weeks ago

I saw this occur locally while clicking around working through a rewrite of the Rails form UIs to use turbo streams. What I did was:

Checking the network traffic between my browser and the server, I observed things in the following order:

What I think is happening here is that Chrome is following the GET link to sign_out. This is on me, since I've wired up the sign_out link to be a regular link, not a form whose method is DELETE like I would have normally done.

I can't say why Chrome chooses to follow this when it does, but when it does it would have the effect of causing a mismatch of the CSRF token since it signs you out of the app. On top of the turbo stream changes, I'll be updating the Rails UI a bit to look a little more like the React one and will make the sign out buttons part of a form so that Chrome won't try to follow them to preload the content.

jsonin commented 2 weeks ago

@jsonin do you remember what you had just done previously, if anything?

I cant remember. I will make a better habit of including that for any next bug.

fermion commented 2 weeks ago

@jsonin do you remember what you had just done previously, if anything?

I cant remember. I will make a better habit of including that for any next bug.

@jsonin all good. I just had a hunch that this might be connected to a certain set of actions being taken 🤷🏻

fermion commented 1 week ago

Should hopefully be fixed with https://github.com/goinvo/staffplan_redux/pull/349 🤞🏻