-
Notifications
You must be signed in to change notification settings - Fork 29
feat: add Svelte support #91
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
base: main
Are you sure you want to change the base?
Conversation
a32fc79
to
558af77
Compare
🦋 Changeset detectedLatest commit: b8444cd The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have to wrap the tests here in a $effect.root
since useLiveQuery
has usage of $effect
. More info here - https://svelte.dev/docs/svelte/testing#Unit-and-integration-testing-using-Vitest
}) | ||
|
||
// Wait for the transaction to be committed | ||
await tx.isPersisted.promise |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since $effect.root
can't have an async callback, we have to move this promise out of it and create different $effect.root
s
const state = () => useStore(compiledQuery.results.derivedState).current | ||
const data = () => useStore(compiledQuery.results.derivedArray).current |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Originally tried to use a $derived
function here, but useStore
for some reason is not reactive. This is still valid usage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same problem in Solid, I think if we want it to work useStore
needs to receive a function otherwise the signal/rune for compiledQuery
is not registered in useStore
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I updated it to not use useStore
for now. I think as long as the tests pass then we're good 👍🏼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests may pass but the value will not be reactive, which may cause the component not to update.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you seen the updated code? What do you think about it?
So this means all tanstack store packages needs to be updated then?
WIP: Svelte support
Draft until
useStore
is usable with reactive Store instances - see TanStack/store#193