Remove recoil sync (#11569)

Recoil-sync was causing issues with Firefox, replacing it with a simpler
mechanism to hydrate variables on page load

---------

Co-authored-by: etiennejouan <jouan.etienne@gmail.com>
This commit is contained in:
Félix Malfait
2025-04-15 13:32:12 +02:00
committed by GitHub
parent 6c2d64dcb2
commit e8db0176a1
17 changed files with 102 additions and 139 deletions

View File

@ -1,26 +0,0 @@
import { urlSyncEffect } from 'recoil-sync';
import { createState } from 'twenty-ui/utilities';
export const animateModalState = createState<boolean>({
key: 'animateModalState',
defaultValue: true,
effects: [
urlSyncEffect({
itemKey: 'animateModal',
refine: (value: unknown) => {
if (typeof value === 'boolean') {
return {
type: 'success',
value: value as boolean,
warnings: [],
} as const;
}
return {
type: 'failure',
message: 'Invalid animateModalState',
path: [] as any,
} as const;
},
}),
],
});

View File

@ -1,34 +1,8 @@
import { BillingCheckoutSession } from '@/auth/types/billingCheckoutSession.type';
import { BILLING_CHECKOUT_SESSION_DEFAULT_VALUE } from '@/billing/constants/BillingCheckoutSessionDefaultValue';
import { syncEffect } from 'recoil-sync';
import { createState } from 'twenty-ui/utilities';
export const billingCheckoutSessionState = createState<BillingCheckoutSession>({
key: 'billingCheckoutSessionState',
defaultValue: BILLING_CHECKOUT_SESSION_DEFAULT_VALUE,
effects: [
syncEffect({
itemKey: 'billingCheckoutSession',
refine: (value: unknown) => {
if (
typeof value === 'object' &&
value !== null &&
'plan' in value &&
'interval' in value &&
'requirePaymentMethod' in value
) {
return {
type: 'success',
value: value as BillingCheckoutSession,
warnings: [],
} as const;
}
return {
type: 'failure',
message: 'Invalid BillingCheckoutSessionState',
path: [] as any,
} as const;
},
}),
],
});