Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix React Compiler lints + improve performance #11450

Merged
merged 87 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from 59 commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
bf7bdea
Batch refetches for different `listDirectory` queries
MrFlashAccount Oct 22, 2024
855a199
Smarter memoization for `AssetRow`
somebody1234 Oct 22, 2024
ff06b1d
Remove `visibility` from Assets Table state
somebody1234 Oct 22, 2024
1ad4449
Remove `AssetTreeNode.createdAt`
somebody1234 Oct 22, 2024
28b93cb
Avoid memoizing `AssetRow`
somebody1234 Oct 22, 2024
a6e49e4
Replace `AssetTreeNode` with `AnyAsset` in `AssetRow`
somebody1234 Oct 22, 2024
edbf46d
Fix item memoization
somebody1234 Oct 22, 2024
4160c57
Fix errors
somebody1234 Oct 22, 2024
8f9689b
Fix `deepEqual`
somebody1234 Oct 23, 2024
8e13e77
Remove memoization of `useAssetPassiveListener` return value
somebody1234 Oct 28, 2024
11cc6a3
Merge branch 'develop' into wip/sb/optimize-asset-table-rendering
somebody1234 Oct 28, 2024
d940a87
Use `fast-deep-equal` for `deepEqual`
somebody1234 Oct 30, 2024
19d15c9
Fix `react-compiler` lints
somebody1234 Oct 30, 2024
a053cfe
Remove `fast-deep-equal`
somebody1234 Oct 30, 2024
f767299
Remove unnecessary React Compiler deoptimizations
somebody1234 Oct 30, 2024
550449c
Fix lints
somebody1234 Oct 30, 2024
fd5ca26
Revert "Fix lints"
somebody1234 Oct 30, 2024
7978c13
Revert "Remove unnecessary React Compiler deoptimizations"
somebody1234 Oct 30, 2024
5b6a043
Revert "Fix `react-compiler` lints"
somebody1234 Oct 30, 2024
35b692d
Reapply "Fix `react-compiler` lints"
somebody1234 Oct 31, 2024
0653ef8
Reapply "Remove unnecessary React Compiler deoptimizations"
somebody1234 Oct 31, 2024
f72c67a
Reapply "Fix lints"
somebody1234 Oct 31, 2024
1c317b4
Merge branch 'develop' into wip/sb/fix-react-compiler-lints
somebody1234 Nov 6, 2024
cfc0e0a
Fix `useForm`
somebody1234 Nov 6, 2024
e3aca44
Remove unnecessary lint disable in `scrollHooks`
somebody1234 Nov 6, 2024
175b935
Remove more unnecessary lint disables
somebody1234 Nov 6, 2024
2dddd33
Minor fixes
somebody1234 Nov 6, 2024
2c015c4
Remove `react-compiler` lint suppression in `FocusArea.tsx`
somebody1234 Nov 6, 2024
b320c80
Clean up `FocusArea.tsx`
somebody1234 Nov 6, 2024
e27db30
Merge branch 'develop' into wip/sb/fix-react-compiler-lints
somebody1234 Nov 13, 2024
4796e3b
Type-safe login form
somebody1234 Nov 13, 2024
1c7f2ba
Remove unnecessary docs
somebody1234 Nov 13, 2024
86ea698
Merge branch 'develop' into wip/sb/fix-react-compiler-lints
somebody1234 Nov 15, 2024
0399f1b
Revert changes to `useForm`
somebody1234 Nov 15, 2024
9644eee
Tiny improvements
MrFlashAccount Nov 16, 2024
df4559b
FIx some pref issues
MrFlashAccount Nov 16, 2024
5f9b0e9
Tiny, but noticable perf improvements
MrFlashAccount Nov 16, 2024
b0aa5e2
use transitions
MrFlashAccount Nov 16, 2024
67330cb
Tiny perf impr x2
MrFlashAccount Nov 17, 2024
2eb6f3d
Tiny fixes
MrFlashAccount Nov 17, 2024
9b8fe6d
THings
MrFlashAccount Nov 17, 2024
bdde9a2
fix types
MrFlashAccount Nov 17, 2024
a70e3b1
Significant improvement in rerendering the Assets Table
MrFlashAccount Nov 17, 2024
bca2409
Improve overall performance
MrFlashAccount Nov 17, 2024
bdbac7f
Improve perf
MrFlashAccount Nov 17, 2024
26edac1
Fixes
MrFlashAccount Nov 17, 2024
e4b7082
Fix some React Compiler errors
somebody1234 Nov 18, 2024
f9ef8f2
Remove section headers from `AssetsTable`
somebody1234 Nov 18, 2024
1809cf3
Apply TypeScript suggested refactor
somebody1234 Nov 18, 2024
957cb2e
Remove unnecessary `useSingleUnmount` - refs are called with `null` f…
somebody1234 Nov 18, 2024
a30d8b8
Fix `AssetRow`
somebody1234 Nov 18, 2024
45aecb7
Refactor out `assetTree` query
somebody1234 Nov 18, 2024
752e024
Refactor out `useDirectoryIds`
somebody1234 Nov 18, 2024
f16b8ff
Refactor out `useAssetsTableItems`
somebody1234 Nov 18, 2024
32afbd4
Memoize TanStack Query mutations in `useUploadFileWithToastMutation`
somebody1234 Nov 18, 2024
aea7f5b
Prettier
somebody1234 Nov 18, 2024
cb08bc0
Improve expand and collapse perf
MrFlashAccount Nov 18, 2024
6f91ddf
Prettify
MrFlashAccount Nov 18, 2024
bd776b4
Fixes
MrFlashAccount Nov 18, 2024
54e1dfc
Fix prettier
MrFlashAccount Nov 18, 2024
a50c6cb
fixes
MrFlashAccount Nov 18, 2024
a3828f7
Prettier
somebody1234 Nov 18, 2024
a4cc854
Improve performace a little bit
MrFlashAccount Nov 18, 2024
1b76348
Small fixes x2
MrFlashAccount Nov 18, 2024
1c9688b
Fix directory icon arrow rotation
somebody1234 Nov 18, 2024
245e76c
fix lint
MrFlashAccount Nov 18, 2024
4487533
fix lints
MrFlashAccount Nov 18, 2024
ae5abe2
Fix icons
MrFlashAccount Nov 19, 2024
88c6dcc
Prettier
somebody1234 Nov 19, 2024
462748e
Fix overfetching
MrFlashAccount Nov 19, 2024
b6fc635
fix tests
MrFlashAccount Nov 19, 2024
d1ec9d1
fix lint
MrFlashAccount Nov 19, 2024
579399d
fix button
MrFlashAccount Nov 20, 2024
08a67bf
Merge branch 'develop' into wip/sb/fix-react-compiler-lints
somebody1234 Nov 20, 2024
8d9201c
Merge branch 'develop' into wip/sb/fix-react-compiler-lints
somebody1234 Nov 20, 2024
7724e29
Merge branch 'develop' into wip/sb/fix-react-compiler-lints
mergify[bot] Nov 20, 2024
7309288
Fix localstorage race conditions
MrFlashAccount Nov 20, 2024
757ac7b
Fix types
MrFlashAccount Nov 20, 2024
d8722cd
Fix prettier
MrFlashAccount Nov 20, 2024
38df45e
Fix eslint
MrFlashAccount Nov 20, 2024
a5f000b
Merge branch 'develop' into wip/sb/fix-react-compiler-lints
somebody1234 Nov 20, 2024
38e201e
Merge branch 'develop' into wip/sb/fix-react-compiler-lints
somebody1234 Nov 21, 2024
4059288
Merge branch 'develop' into wip/sb/fix-react-compiler-lints
mergify[bot] Nov 21, 2024
b7da0cf
Named imports for `Button`
somebody1234 Nov 21, 2024
fd9555a
Merge branch 'develop' into wip/sb/fix-react-compiler-lints
somebody1234 Nov 21, 2024
6eb7541
Named imports for `Button`
somebody1234 Nov 21, 2024
27efdfd
Memoize `Button`
somebody1234 Nov 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions app/common/src/services/Backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -842,8 +842,6 @@ export function isPlaceholderId(id: AssetId) {
return false
}

console.log('isPlaceholderId id', id, PLACEHOLDER_SIGNATURE in id)

return PLACEHOLDER_SIGNATURE in id
}

Expand Down
3 changes: 1 addition & 2 deletions app/gui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
"build": "vite build",
"build-cloud": "cross-env CLOUD_BUILD=true corepack pnpm run build",
"preview": "vite preview",
"//": "max-warnings set to 41 to match the amount of warnings introduced by the new react compiler. Eventual goal is to remove all the warnings.",
"lint": "eslint . --max-warnings=41",
"lint": "eslint . --max-warnings=0",
"format": "prettier --version && prettier --write src/ && eslint . --fix",
"dev:vite": "vite",
"test": "corepack pnpm run /^^^^test:.*/",
Expand Down
29 changes: 21 additions & 8 deletions app/gui/src/dashboard/components/AnimatedBackground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* `<AnimatedBackground />` component visually highlights selected items by sliding a background into view when hovered over or clicked.
*/
import type { Transition } from 'framer-motion'
import type { Transition, Variants } from 'framer-motion'
import { AnimatePresence, motion } from 'framer-motion'
import type { PropsWithChildren } from 'react'
import { createContext, memo, useContext, useId, useMemo } from 'react'
Expand Down Expand Up @@ -92,9 +92,16 @@ AnimatedBackground.Item = memo(function AnimatedBackgroundItem(props: AnimatedBa
animationClassName,
children,
isSelected,
underlayElement = <div className={twJoin('h-full w-full', animationClassName)} />,
underlayElement: rawUnderlayElement,
} = props

const defaultUnderlayElement = useMemo(
() => <div className={twJoin('h-full w-full', animationClassName)} />,
[animationClassName],
)

const underlayElement = rawUnderlayElement ?? defaultUnderlayElement

const context = useContext(AnimatedBackgroundContext)
invariant(context, '<AnimatedBackground.Item /> must be placed within an <AnimatedBackground />')
const { value: activeValue, transition, layoutId } = context
Expand All @@ -107,15 +114,15 @@ AnimatedBackground.Item = memo(function AnimatedBackgroundItem(props: AnimatedBa
const isActive = isSelected ?? activeValue === value

return (
<div className={twJoin('relative *:isolate', className)}>
<div className={twJoin('relative', className)}>
<AnimatedBackgroundItemUnderlay
isActive={isActive}
underlayElement={underlayElement}
layoutId={layoutId}
transition={transition}
/>

{children}
<div className="isolate contents">{children}</div>
</div>
)
})
Expand All @@ -130,6 +137,11 @@ interface AnimatedBackgroundItemUnderlayProps {
readonly transition: Transition
}

const VARIANTS: Variants = {
hidden: { opacity: 0 },
visible: { opacity: 1 },
}

/**
* Underlay for {@link AnimatedBackground.Item}.
*/
Expand All @@ -145,11 +157,12 @@ const AnimatedBackgroundItemUnderlay = memo(function AnimatedBackgroundItemUnder
<motion.div
layout="position"
layoutId={`background-${layoutId}`}
className="pointer-events-none absolute inset-0"
className="pointer-events-none absolute inset-0 isolate"
transition={transition}
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
variants={VARIANTS}
initial="hidden"
animate="visible"
exit="hidden"
>
{underlayElement}
</motion.div>
Expand Down
Loading
Loading