Fully deprecate old recoil (#18210)
## Summary Removes the `recoil` dependency entirely from `package.json` and `twenty-front/package.json`, completing the migration to Jotai as the sole state management library. Removes all Recoil infrastructure: `RecoilRoot` wrapper from `App.tsx` and test decorators, `RecoilDebugObserver`, Recoil-specific ESLint rules (`use-getLoadable-and-getValue-to-get-atoms`, `useRecoilCallback-has-dependency-array`), and legacy Recoil utility hooks/types (`useRecoilComponentState`, `useRecoilComponentValue`, `createComponentState`, `createFamilyState`, `getSnapshotValue`, `cookieStorageEffect`, `localStorageEffect`, etc.). Renames all `V2`-suffixed Jotai state files and types to their canonical names (e.g., `ComponentStateV2` -> `ComponentState`, `agentChatInputStateV2` -> `agentChatInputState`, `SelectorCallbacksV2` -> `SelectorCallbacks`), and removes the now-redundant V1 counterparts. Updates ~433 files across the codebase to use the renamed Jotai imports, remove Recoil imports, and clean up test wrappers (`RecoilRootDecorator` -> `JotaiRootDecorator`).
This commit is contained in:
@@ -1,40 +0,0 @@
|
||||
import { useRecoilTransactionObserver_UNSTABLE } from 'recoil';
|
||||
|
||||
import { logDebug } from '~/utils/logDebug';
|
||||
|
||||
const formatTitle = (stateName: string) => {
|
||||
const headerCss = [
|
||||
'color: gray; font-weight: lighter',
|
||||
'color: black; font-weight: bold;',
|
||||
];
|
||||
|
||||
const parts = ['%c recoil', `%c${stateName}`];
|
||||
|
||||
return [parts.join(' '), ...headerCss];
|
||||
};
|
||||
|
||||
export const RecoilDebugObserverEffect = () => {
|
||||
const isDebugMode = process.env.IS_DEBUG_MODE === 'true';
|
||||
|
||||
useRecoilTransactionObserver_UNSTABLE(({ snapshot }) => {
|
||||
if (!isDebugMode) {
|
||||
return;
|
||||
}
|
||||
for (const node of Array.from(
|
||||
snapshot.getNodes_UNSTABLE({ isModified: true }),
|
||||
)) {
|
||||
const loadable = snapshot.getLoadable(node);
|
||||
|
||||
const titleArgs = formatTitle(node.key);
|
||||
|
||||
console.groupCollapsed(...titleArgs);
|
||||
|
||||
logDebug('STATE', loadable.state);
|
||||
|
||||
logDebug('CONTENTS', loadable.contents);
|
||||
|
||||
console.groupEnd();
|
||||
}
|
||||
});
|
||||
return null;
|
||||
};
|
||||
Reference in New Issue
Block a user