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

Svelte support #1015

Open
aboodman opened this issue Jul 31, 2022 · 1 comment
Open

Svelte support #1015

aboodman opened this issue Jul 31, 2022 · 1 comment
Labels
Future Something we want to fix but is not blocking next release

Comments

@aboodman
Copy link
Contributor

Right now it is theoretically possible to use Replicache with svelte but not easy as there is no sample. It's also possible feature work is necessary to make it work well (for example, for Solid, we know that #1010 is required).

We should create a sample/quickstart for Svelte and make sure it works well.

@arv arv added the Future Something we want to fix but is not blocking next release label Oct 20, 2022
@csenio
Copy link

csenio commented Aug 23, 2023

Svelte has a small pitfall when the scan function isn't pure. Need to manually clean those up in a reactive statement like this:

	let unsub
	$: {
		unsub?.()
		unsub = rep.subscribe(tx => tx.scan({prefix: `users/${currentTeam}`}).values().toArray())
	}
	onDestroy(unsub)

The best abstraction I found was making a renderless component out of it and then using it like this:

<Rep
  prefix={`channels/${$activeTeam.id}`}
  onData={(data) => {
    // do whatever you want with the data
  }}
/>

There is an issue for it but it's closed: sveltejs/svelte#5283

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Future Something we want to fix but is not blocking next release
Projects
Status: Planned
Development

No branches or pull requests

3 participants