Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug where SSR is dispatched twice when errors exist #489

Merged
merged 1 commit into from
Jan 14, 2023

Conversation

reinink
Copy link
Member

@reinink reinink commented Jan 14, 2023

This PR fixes a bug with the Inertia Blade directives that cause the SSR node server to be called twice in the event of a JavaScript related failure.

image

This happens because the \Inertia\Ssr\Gateway returns either an \Inertia\Ssr\Response (on success), or null on failure (a JavaScript error), which is saved in the $__inertiaSsr variable, and then we check to see if that variable isset to prevent calling the SSR server twice. Problem is, in PHP calling isset() on a variable that's null returns false, even if that variable has been set.

This PR fixes this by introducing a new $__inertiaSsrDispatched variable to keep track of whether the SSR server has been dispatched, regardless of the response.

@reinink reinink merged commit c07625d into master Jan 14, 2023
@reinink reinink deleted the fix-directive-double-dispatch branch January 14, 2023 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant