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/SvelteKit official sdk support #23

Open
smblee opened this issue Jul 6, 2022 · 6 comments
Open

Svelte/SvelteKit official sdk support #23

smblee opened this issue Jul 6, 2022 · 6 comments

Comments

@smblee
Copy link

smblee commented Jul 6, 2022

With Svelte also gaining some popularity, it would be nice to see some official documentation around Svelte (or the nextJS equivalent sveltekit). Svelte should be pretty straightforward, but sveltekit might be a bit more tricky as it can both be SSR/CSR similar to NextJS.

As a reference, LaunchDarkly currenlty does have an official tutorial/sdk on svelte/sveltekit (https://docs.launchdarkly.com/guides/platform-specific/svelte)

@vijaye-statsig
Copy link
Member

@tore-statsig what do you think?

@tore-statsig
Copy link
Contributor

Right now we are focused on support for Flutter/dart and elixir/erlang, but we can look into Svelte after those!

It does look like the LaunchDarkly link your provided just gives some direction around how to use their js client sdk and node-js server sdk with the svelte framework, so this shouldnt require a new SDK.

For now, I think you should be able to follow similar steps with Statsig in terms of initializing the SDK and using it on the client side with Svelte.

I think our SSR steps/using SvelteKit will differ more.

@smblee
Copy link
Author

smblee commented Jul 7, 2022

Gotcha. Yea we are currently using SvelteKit and it was actually pretty finicky to get the hybrid (CSR/SSR) solution working correctly (especially with the sveltekit's load function). So for now, we are thinking of doing SSR only and hydrating down to CSR until we can think of a better solution.

@tore-statsig
Copy link
Contributor

tore-statsig commented Jul 7, 2022

Did you look at the statsig SSR info for the node sdk? The node server SDK has a function that will generate the initialize values for a user:

https://docs.statsig.com/server/nodejsServerSDK#ssr

And then the js-client sdk takes that in.

Right now, we only document the flow for react, but the react SDK just uses our js sdk internally. Here's the call to set the values for the client SDK

https://github.com/statsig-io/react-sdk/blob/main/src/StatsigSynchronousProvider.tsx#L62

@smblee
Copy link
Author

smblee commented Jul 12, 2022

Was able to get something implemented but it was definitely a bit complex to get working. Feel free to close, but might be worth having it be opened for official support? (at least documentation)

@tore-statsig
Copy link
Contributor

Yeah we will keep it open for now. Glad you got something working!

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

No branches or pull requests

3 participants