Entitlements, served from cache first and kept current.
The initial value is the SDK's last-known cache rather than null, because
the alternative is a first paint that shows the paywall to someone who has
already paid to remove it. The network result replaces it when it arrives.
null and {} are deliberately different: {} is a real answer meaning
the subscriber has no entitlements, null means we have not found out.
Collapsing them makes an outage indistinguishable from an unsubscribed
user, and that difference decides whether an app locks someone out.
After identify() or logOut() changes who this is, the previous
identity's entitlements are dropped at once and fetched again: until the
answer arrives the hook returns what is cached for the new identity
(null after a logOut() or a merge) with isLoading: true. An answer
that was already on its way for the previous identity is ignored. Every
component using this hook shares one request and one value, and a newer
answer to getEntitlements() called anywhere reaches all of them.
A failed request sets error and keeps the value already shown for this
identity. Replacing it with null on a transient failure would flash the
paywall at a paying subscriber.
Entitlements, served from cache first and kept current.
The initial value is the SDK's last-known cache rather than null, because the alternative is a first paint that shows the paywall to someone who has already paid to remove it. The network result replaces it when it arrives.
nulland{}are deliberately different:{}is a real answer meaning the subscriber has no entitlements,nullmeans we have not found out. Collapsing them makes an outage indistinguishable from an unsubscribed user, and that difference decides whether an app locks someone out.After
identify()orlogOut()changes who this is, the previous identity's entitlements are dropped at once and fetched again: until the answer arrives the hook returns what is cached for the new identity (nullafter alogOut()or a merge) withisLoading: true. An answer that was already on its way for the previous identity is ignored. Every component using this hook shares one request and one value, and a newer answer togetEntitlements()called anywhere reaches all of them.A failed request sets
errorand keeps the value already shown for this identity. Replacing it with null on a transient failure would flash the paywall at a paying subscriber.