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

how do you supply a decision from server-side rendering to client-side rendering? #185

Open
iamstarkov opened this issue Dec 15, 2022 · 9 comments

Comments

@iamstarkov
Copy link

  1. I run createInstance on both server and client to get optimizely client.
  2. I run client.setUser({ id: userId }) with the same user id and attributes on both server and client.
  3. I use <OptimizelyProvider optimizely={client} user={{ id: userId }}> and both server (with isServerSide prop) and client.
  4. I use useDecision hook on both server and client and use the derived decision to render true or false if feature flag is disabled or not.
  5. Sometimes I get the mismatch between SSR and CSR.

I have tried to run client.decideAll() to get serialisable decisions on the server and tried to supply it to client-side created instance of the client, but I could not find a way to do it. Can you help?

@mikechu-optimizely
Copy link
Contributor

Hi @iamstarkov,

Let me research on this and speak with one of the JS devs specifically.

@mikechu-optimizely
Copy link
Contributor

Relates to #186

@tareqlol
Copy link

tareqlol commented Jun 6, 2024

Hey @mikechu-optimizely,
Any updates on this?

@mikechu-optimizely
Copy link
Contributor

mikechu-optimizely commented Jun 18, 2024

@junaed-optimizely Can we pair up on SSR & CSR when you're back from holiday? DM me please 😄

@mikechu-optimizely
Copy link
Contributor

mikechu-optimizely commented Jun 21, 2024

We have a work epic (series of tickets) to create a starter-kit or examples for CSR, SSR, and hybrid. We have already identified some rough edges that we want to provide guidance around or software updates to resolve. We'll start the first of these tickets in an upcoming sprint to show reference implementations. Please stay tuned.

@ricky-harrys
Copy link

@mikechu-optimizely Any update on this? Specifically looking for details around implementing Optimizely FX in Remix on Cloudflare Pages.

@mikechu-optimizely
Copy link
Contributor

@junaed-optimizely, I don't see an FSSDK backlog entry for this. Do you have any updates?

If not, can you write a story and note the ticket here? We need to put together more info in around our SSR vs CSR implementation.

@junaed-optimizely
Copy link
Contributor

junaed-optimizely commented Oct 15, 2024

@iamstarkov, I am curious to know about the mismatch in detail. Also it would be nice to know more about the implementation detail as well, like what framework are you using, and how and where you are creating the instance! Here is a POC that might be helpful - nextjs-optimizely.

@junaed-optimizely
Copy link
Contributor

@mikechu-optimizely, I agree 100%. Our documentation does not have enough implementation detail on SSR. I have created an internal ticket FSSDK-10777 to address this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants