Recieve a Writable as External Open State #1367
Tyler-Petrov
started this conversation in
Feature Requests / Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Prerequisites
The Code Snippet
The Explanation
This is certainly a contrived example, and if this were my actual use case, I'd just use a
$state
rune and call it a day. I have to use a writable for external reasons. For some reason, svelte doesn't allow subscribing directly to a writable property of an object in this manner.The bind:open directive is broken up into its getter and setter functions, allowing it to work with the writable without needing a separate variable for the store subscription.
The Solution
The solution I'm proposing is for the collapsible component (and perhaps dialog and alert-dialog too) to be able to receive a
Writable<boolean>
directly for the open property. The component would then check if the open property is a writable. If it is, the component would subscribe to it; otherwise, it would use the existing implementation.Beta Was this translation helpful? Give feedback.
All reactions