Migrating to v1 from v0
The only change v1 of@suprsend/react introduces is tenant scoping across the sdk.
If you use headless
@suprsend/react-core, follow this same section for
migrating to its v2 from v1 — the changes are identical.Tenant scoping
Skip this guide if you don’t use multi-tenant architecture, i.e. if you don’t pass tenant id in userToken jwt payload and don’t use tenant id fields for preferences and in-app feed. PasstenantId prop in SuprSendProvider and the rest of the SDK, including preferences and in-app feed, uses it. Changing the tenantId prop switches the active tenant of the identified user.
The per-call tenantId params in v0 still work and override the active tenant, so you can migrate gradually or leave your v0 code as is.
v1
v0
scope.tenant_id of the userToken, else the server throws scoping error.
Behaviour changes to note
InboxandSuprSendFeedProviderno longer default theirtenantIdto thedefaulttenant. WhentenantIdis not passed, the feed follows the active tenant set onSuprSendProvider(falling back to thedefaulttenant) and re-initializes automatically whenever the active tenant changes. PassingtenantIdto them pins the feed to that tenant — it takes priority over the active tenant and the feed ignores later tenant changes on the provider.- Previously fetched preferences keep the tenant they were fetched with. Call
getPreferencesagain after a tenant change to load the new tenant’s data.