-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
reactive actions #15243
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
Comments
Sorry I don't understand the issue here...you can still return an object containing How is this affecting your library? |
@adiguba @paoloricciuti Is my issue related to #6942? Thanks @adiguba for the code. That is an ugly workaround but beautiful solution on your part. I can't wait for action's API to get updated. |
@adiguba Does your code snippet change if the argument is actually an object: interface Options {
disable: boolean;
wheelInversion: boolean;
}
const scrollEvents: Action = (node: HTMLElement, options: Options) => {
In your code snippet, it doesn't use that. |
Not really...that issue is about dynamically change the variable containing the function that is the action and re register it on the element. Your issue is about how to get updates to the argument of an action but as I've said that is already possible, either with the update method like @adiguba showed you or with an effect |
@paoloricciuti How do you do with an effect? |
Like this |
Describe the problem
Can we reconsider the restriction against the reactivity of actions from argument changes. Seems to go against the philosophy of Svelte and is effecting a library I am building.
The docs: https://svelte.dev/docs/svelte/use state:
I am trying to convert y-direction mouse wheel scrolls into the x-direction on desktop sites, but not have any effect on mobile devices. On Mobile sites, I pass
disable=true
. When the screen resizes to small I consider it a "mobile device"Simplified example below:
Describe the proposed solution
Make actions reactive upon argument changes
Importance
nice to have
The text was updated successfully, but these errors were encountered: