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

[failing test] add test for adding/removing/re-adding modifier with if #20630

Open
wants to merge 1 commit into
base: lts-3-28
Choose a base branch
from

Conversation

fivetanley
Copy link
Member

This test currently fails if the modifier is inside an (if) statement, and if the condition changes from true -> false -> true.

It seems like somehow when the 3rd re-render to true happens, the modifier helper gets a clone of the first two positional arguments (the event name and the callback). The modifier helper gets 4 arguments when it should only be getting two. See the screenshot to see that the first two arguments are the same as the last two arguments:

Screenshot 2024-01-24 at 21 13 54

This should work, but on 3.28.12 throws the following error message:

Uncaught (in promise) Error: You can only pass two positional arguments (event name and callback) to the `on` modifier, but you provided 4. Consider using the `fn` helper to provide additional arguments to the `on` callback.
    at OnModifierState.updateFromArgs (runtime.js:7277:1)
    at OnModifierManager.install (runtime.js:7486:1)
    at runtime.js:4840:1
    at track (validator.js:820:1)
    at TransactionImpl.commit (runtime.js:4839:1)
    at EnvironmentImpl.commit (runtime.js:4936:1)
    at inTransaction (runtime.js:4961:1)
    at Renderer._renderRoots (index.js:7779:1)
    at Renderer._renderRootsTransaction (index.js:7831:1)
    at Renderer._revalidate (index.js:7873:1)

This test currently fails if the modifier is inside an `(if)` statement,
and if the condition changes from true -> false -> true.

It seems like somehow when the 3rd re-render to true happens, the `modifier`
helper gets a clone of the first two positional arguments (the event name and the
callback). The `modifier` helper gets 4 arguments when it should only be getting two.
@fivetanley
Copy link
Member Author

Trying to address #20631

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