Skip to content

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

@iamstarkov

Description

@iamstarkov
  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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions