Fix the JavaScript hook example in the Livewire 3 skill - #927
Open
sulimanbenhalim wants to merge 1 commit into
Open
Fix the JavaScript hook example in the Livewire 3 skill#927sulimanbenhalim wants to merge 1 commit into
sulimanbenhalim wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The JS hooks example in the Livewire 3 skill has two hooks in it, and neither one fires on v3.
message.failedis a Livewire 2 hook. The v3 upgrade guide lists it under "New lifecycle hooks" as one of the fourmessage.*hooks folded intocommit, with the old body moving into thefail()callback. Nothing dispatchesmessage.failedin v3, so that handler is dead.The 419 check has the wrong shape. It reads
fail.status, butfailis the callback registrar, not the failure object.statusshows up on the callback's argument, sofailis truthy,fail.statusisundefined, and the branch never runs. The guide covers this exact case under "Page expired hook", since it's the documented replacement for v2'sLivewire.onPageExpired():I followed that, kept the skill's original
alert()text, and includedpreventDefault()like the guide does, otherwise Livewire's own page-expired dialog fires on top of the alert.Looks like the example started as a port of the Livewire 2 skill's
onPageExpired()/onError()pair and the shape got lost on the way over. It's the only JS example in the skill, so right now an agent following it writes session-expiry and failure handling that silently does nothing.Covers item 4 of #895, the rest of that issue is untouched. One
.aifile, no test, same as #918 and #913.