Skip to content

Commit 104f2a6

Browse files
committed
fix(whitelabeling): parse the whitelabel read from a server that predates the entitlement field
1 parent fdfffce commit 104f2a6

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

‎apps/sim/ee/whitelabeling/hooks/whitelabel.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ async function fetchWhitelabelSettings(
4343
params: { id: orgId },
4444
signal,
4545
})
46-
return { isEnterprise, settings: data }
46+
// A server from before the field omits it; saving still enforces the entitlement.
47+
return { isEnterprise: isEnterprise ?? true, settings: data }
4748
}
4849

4950
/**

‎apps/sim/lib/api/contracts/organization.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,10 +676,11 @@ const organizationWhitelabelEnvelopeResponseSchema = z.object({
676676
* The read also carries the entitlement the update enforces, so the settings page can gate on it
677677
* without a separate billing read. It sits beside `data` rather than inside it: `data` keeps the
678678
* settings shape clients already parse, so a client from before this field reads the same response.
679+
* It is optional so a client reading a server from before this field still parses the settings.
679680
*/
680681
const organizationWhitelabelReadResponseSchema =
681682
organizationWhitelabelEnvelopeResponseSchema.extend({
682-
isEnterprise: z.boolean(),
683+
isEnterprise: z.boolean().optional(),
683684
})
684685

685686
export const getOrganizationWhitelabelContract = defineRouteContract({

0 commit comments

Comments
 (0)