Repository navigation
v1.74.1
Fixed
-
A user-property write during an onboarding no longer blanks the app.
OnboardingDataGatefollowed the user-property store reactively: a
setUserPropertymid-flow changed the merged audience params, the React Query
key followed them, the query answereddata: undefinedfor the never-seen key,
and the gate renderednull— unmounting the entire subtree under the
provider (in hosts that wrap the app: router reset, every screen's state lost),
refetchingget-onboarding-steps, and remounting. The only workaround was to
seed every property before the provider mounted.The rule now is: audience resolution happens at serve time, and a served
payload is frozen for that presentation.OnboardingProviderresolves the
effective params once, from the first ready snapshot of the store, and
pins them for the lifetime of the mount (useAudienceParams); the data gate
just fetches what it is handed. A property written during the flow — or a change to
thecustomAudienceParamsprop — does not re-key, refetch or swap the
onboarding; it applies to the next serve (next mount, next launch). Hosts
can write a property the moment they compute it, even mid-onboarding. The
corollary: anything the current serve must target on has to be set before
the provider mounts.reset()likewise clears for the next serve.PaywallProvideris deliberately unchanged: a paywall is served at
register(moment), so it is right that its catalog follows the store until
then, and it never blanks while refetching.The escape hatch is intact:
client.clearCache()plus invalidating
["onboardingQuestions", …]still refetches — the same query, under the pinned
audience, without an unmount. Re-targeting with the current properties is a
new serve: remount the provider — at a flow boundary, since a remount is the
full teardown. -
useOnboardingStep/useOnboardingStartnow build the query the gate
served. They built their ownuseSuspenseQueryfrom the raw
customAudienceParamsprop, while the gate (since 1.74.0) merged the store over
it — so with a non-empty store the two keys differed: a second fetch, resolved
without the user's properties, and that was the payload the screens
rendered.OnboardingProvidernow resolves the params once and hands that
same value to both the data gate and theOnboardingProgressContextthe hooks
already read, so both build the same query and there is exactly one fetch.
The hooks themselves are unchanged.
Changed
- Tests — the headless package can now render React in tests (
react-dom+
jsdomdev dependencies,*.test.tsxexcluded fromtsc). The provider suite
renders the realOnboardingProvideragainst a fake client.