Description
Is there an existing issue for this?
- I have searched the existing issues
SDK Version
3.0.0
Current Behavior
I have an OptimizelyProvider
in a 'use client'
component that is SSRed. It receives the user directly on the initial render.
In another 'use client'
component that is SSRed, I use useDecision
with autoUpdate:false
.
The output of useDecision
is an error: "Unable to evaluate feature "..." because User ID is not set."
Expected Behavior
Since the OptimizelyProvider
receives the user directly during SSR, I would expect that useDecision
already contains the correct decision for that user, and the according variant can be server rendered.
Steps To Reproduce
export const CustomOptimizelyProvider = (props) => {
const [optimizely] = useState(() =>
createInstance({
datafile: props.optimizelyDatafile, // this is fetched synchronously in a server component, so we already have it
}),
)
return <OptimizelyProvider optimizely={optimizely} isServerSide={true} user={props.optimizelyUser} children={props.children} />
}
const Page = () => {
const [decision] = useDecision('beast-test')
return <div>decision: {decision}<div>
}
Might be related to #185
React Framework
next.js 14.0.4
Browsers impacted
all
Link
No response
Logs
No response
Severity
Blocking development
Workaround/Solution
none found yet except for autoUpdate:true
which I want to avoid since the SSR result should already be the correct variant.
Recent Change
I think it was not an issue in the previous major version, but I only tried it in another project, because the current project is new.
Conflicts
No response