mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-28 19:47:08 +02:00
Prevent a bunch more stuff from re-rendering
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
import deepEqual from '@gilbarbara/deep-equal';
|
||||
import type { Folder, GrpcRequest, HttpRequest } from '@yaakapp-internal/models';
|
||||
|
||||
// This is an atom so we can use it in the child items to avoid re-rendering the entire list
|
||||
import { atom } from 'jotai';
|
||||
import { selectAtom } from 'jotai/utils';
|
||||
import { activeWorkspaceAtom } from '../hooks/useActiveWorkspace';
|
||||
import { foldersAtom } from '../hooks/useFolders';
|
||||
import { grpcRequestsAtom } from '../hooks/useGrpcRequests';
|
||||
import { httpRequestsAtom } from '../hooks/useHttpRequests';
|
||||
import { deepEqualAtom } from '../lib/atoms';
|
||||
import { fallbackRequestName } from '../lib/fallbackRequestName';
|
||||
import type { SidebarTreeNode } from './Sidebar';
|
||||
|
||||
@@ -27,11 +26,7 @@ const allPotentialChildrenAtom = atom((get) => {
|
||||
}));
|
||||
});
|
||||
|
||||
const memoAllPotentialChildrenAtom = selectAtom(
|
||||
allPotentialChildrenAtom,
|
||||
(v) => v,
|
||||
(a, b) => deepEqual(a, b),
|
||||
);
|
||||
const memoAllPotentialChildrenAtom = deepEqualAtom(allPotentialChildrenAtom);
|
||||
|
||||
export const sidebarTreeAtom = atom<{
|
||||
tree: SidebarTreeNode | null;
|
||||
|
||||
Reference in New Issue
Block a user