Skip to content

Conversation

@aerni
Copy link
Contributor

@aerni aerni commented Dec 22, 2025

This PR fixes a race condition that caused the Livewire CSRF token to not be replaced at the appropriate time. I never noticed this issue until @robdekort reached out. I was able to reproduce it by throttling the network speed. Fortunately, it was a simple fix.

This implementation has one small catch, though. If the token is replaced on livewire:init, the statamic:csrf.replaced event is dispatched before the window.livewireScriptConfig.csrf is assigned. I don't think this is a big deal but maybe worth mentioning in the docs.

@robdekort
Copy link
Contributor

Thanks for this. Interesting tidbit might be that I never ever ran into this issue before. It's only on a v6 site using Livewire where I ran into this issue: Livewire breaking using full static caching.

@aerni
Copy link
Contributor Author

aerni commented Dec 23, 2025

@robdekort Likely due to this PR #11014

@robdekort
Copy link
Contributor

Ah I see. Only fair then that you fixed it now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants