perf: simplify widget optimizations
This commit is contained in:
1 parent
5ca5bd3bda
commit
0e7d7e0a2f
7 files changed
+18
-67
No files matched your search
+1
-14
@@ -91,17 +91,4 @@ benchmark-results
|
|||||||
homarr-backup*.zip
|
homarr-backup*.zip
|
||||||
*.sqlite-wal
|
*.sqlite-wal
|
||||||
*.sqlite-shm
|
*.sqlite-shm
|
||||||
scripts/benchmarks/analyze-*.mjs
|
/scripts/benchmarks/
|
||||||
scripts/benchmarks/attribute-memory.mts
|
|
||||||
scripts/benchmarks/audit-widget-render.mjs
|
|
||||||
scripts/benchmarks/build-compare.sh
|
|
||||||
scripts/benchmarks/compare-stress-runs.mjs
|
|
||||||
scripts/benchmarks/inspect-container.mts
|
|
||||||
scripts/benchmarks/measure-*.mjs
|
|
||||||
scripts/benchmarks/measure-*.mts
|
|
||||||
scripts/benchmarks/memory-probe.cjs
|
|
||||||
scripts/benchmarks/probe-fiber-tree.mts
|
|
||||||
scripts/benchmarks/stress-restore*.mts
|
|
||||||
scripts/benchmarks/stress-restore*.ts
|
|
||||||
scripts/benchmarks/verify-context-menu.mts
|
|
||||||
scripts/benchmarks/verify-react-profiling.mts
|
|
||||||
@@ -16,7 +16,6 @@ import {
|
|||||||
useSortable,
|
useSortable,
|
||||||
verticalListSortingStrategy,
|
verticalListSortingStrategy,
|
||||||
} from "@dnd-kit/sortable";
|
} from "@dnd-kit/sortable";
|
||||||
import type { ActionIconProps } from "@mantine/core";
|
|
||||||
import { ActionIcon, Card, Center, Fieldset, Loader, Stack } from "@mantine/core";
|
import { ActionIcon, Card, Center, Fieldset, Loader, Stack } from "@mantine/core";
|
||||||
import { IconGripHorizontal } from "@tabler/icons-react";
|
import { IconGripHorizontal } from "@tabler/icons-react";
|
||||||
|
|
||||||
@@ -177,21 +176,6 @@ const Item = <TItem, TOptionValue extends UniqueIdentifier>({
|
|||||||
id,
|
id,
|
||||||
});
|
});
|
||||||
|
|
||||||
const Handle = (props: Partial<ActionIconProps>) => {
|
|
||||||
return (
|
|
||||||
<ActionIcon
|
|
||||||
variant="transparent"
|
|
||||||
color="gray"
|
|
||||||
{...props}
|
|
||||||
{...listeners}
|
|
||||||
ref={setActivatorNodeRef}
|
|
||||||
style={{ cursor: "grab" }}
|
|
||||||
>
|
|
||||||
<IconGripHorizontal />
|
|
||||||
</ActionIcon>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
padding="sm"
|
padding="sm"
|
||||||
@@ -222,7 +206,17 @@ const Item = <TItem, TOptionValue extends UniqueIdentifier>({
|
|||||||
item={item}
|
item={item}
|
||||||
removeItem={removeItem}
|
removeItem={removeItem}
|
||||||
rootAttributes={attributes}
|
rootAttributes={attributes}
|
||||||
handle={Handle}
|
handle={
|
||||||
|
<ActionIcon
|
||||||
|
variant="transparent"
|
||||||
|
color="gray"
|
||||||
|
{...listeners}
|
||||||
|
ref={setActivatorNodeRef}
|
||||||
|
style={{ cursor: "grab" }}
|
||||||
|
>
|
||||||
|
<IconGripHorizontal />
|
||||||
|
</ActionIcon>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -28,11 +28,11 @@ export const { definition, componentLoader } = createWidgetDefinition("bookmarks
|
|||||||
openNewTab: factory.switch({ defaultValue: true }),
|
openNewTab: factory.switch({ defaultValue: true }),
|
||||||
withBorder: factory.switch({ defaultValue: false }),
|
withBorder: factory.switch({ defaultValue: false }),
|
||||||
items: factory.sortableItemList<RouterOutputs["app"]["all"][number], string>({
|
items: factory.sortableItemList<RouterOutputs["app"]["all"][number], string>({
|
||||||
ItemComponent: ({ item, handle: Handle, removeItem, rootAttributes }) => {
|
ItemComponent: ({ item, handle, removeItem, rootAttributes }) => {
|
||||||
return (
|
return (
|
||||||
<Group {...rootAttributes} tabIndex={0} justify="space-between" wrap="nowrap">
|
<Group {...rootAttributes} tabIndex={0} justify="space-between" wrap="nowrap">
|
||||||
<Group wrap="nowrap">
|
<Group wrap="nowrap">
|
||||||
<Handle />
|
{handle}
|
||||||
|
|
||||||
<Group>
|
<Group>
|
||||||
<Avatar src={item.iconUrl} alt={item.name} />
|
<Avatar src={item.iconUrl} alt={item.name} />
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import type React from "react";
|
import type React from "react";
|
||||||
import type { DraggableAttributes, UniqueIdentifier } from "@dnd-kit/core";
|
import type { DraggableAttributes, UniqueIdentifier } from "@dnd-kit/core";
|
||||||
import type { ActionIconProps } from "@mantine/core";
|
|
||||||
import { z } from "zod/v4";
|
import { z } from "zod/v4";
|
||||||
import type { RefinementCtx, ZodType } from "zod/v4";
|
import type { RefinementCtx, ZodType } from "zod/v4";
|
||||||
|
|
||||||
@@ -38,7 +37,7 @@ export interface SortableItemListInput<TItem, TOptionValue extends UniqueIdentif
|
|||||||
item: TItem;
|
item: TItem;
|
||||||
removeItem: () => void;
|
removeItem: () => void;
|
||||||
rootAttributes: DraggableAttributes;
|
rootAttributes: DraggableAttributes;
|
||||||
handle: (props: Partial<Pick<ActionIconProps, "size" | "color" | "variant">>) => React.ReactNode;
|
handle: React.ReactNode;
|
||||||
}) => React.ReactNode;
|
}) => React.ReactNode;
|
||||||
uniqueIdentifier: (item: TItem) => TOptionValue;
|
uniqueIdentifier: (item: TItem) => TOptionValue;
|
||||||
useData: (values: TOptionValue[]) => { data: TItem[] | undefined; isLoading: boolean; error: unknown };
|
useData: (values: TOptionValue[]) => { data: TItem[] | undefined; isLoading: boolean; error: unknown };
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
diff --git a/lib/modem.js b/lib/modem.js
|
|
||||||
index b45a798d63647d55e0193fd7e82c2e36785d9b5f..d2dbf42969fc0ebf39b30c1a27373c33c2d20333 100644
|
|
||||||
--- a/lib/modem.js
|
|
||||||
+++ b/lib/modem.js
|
|
||||||
@@ -3,7 +3,6 @@ var querystring = require('querystring'),
|
|
||||||
fs = require('fs'),
|
|
||||||
path = require('path'),
|
|
||||||
url = require('url'),
|
|
||||||
- ssh = require('./ssh'),
|
|
||||||
HttpDuplex = require('./http_duplex'),
|
|
||||||
debug = require('debug')('modem'),
|
|
||||||
utils = require('./utils'),
|
|
||||||
@@ -263,8 +262,13 @@ Modem.prototype.buildRequest = function (options, context, data, callback) {
|
|
||||||
var connectionTimeoutTimer;
|
|
||||||
var finished = false;
|
|
||||||
|
|
||||||
+ // Loaded here rather than at module scope: './ssh' pulls in ssh2, whose crypto module
|
|
||||||
+ // instantiates a ~16 MiB WebAssembly memory for ChaCha20-Poly1305 as soon as it is
|
|
||||||
+ // required. Measured at +14 MiB RSS for a require alone, paid by every Homarr install
|
|
||||||
+ // even though Docker is reached over a socket and this branch never runs. require() is
|
|
||||||
+ // cached, so SSH connections pay it once and behave exactly as before.
|
|
||||||
var opts = self.protocol === 'ssh' ? Object.assign(options, {
|
|
||||||
- agent: ssh(Object.assign({}, self.sshOptions, {
|
|
||||||
+ agent: require('./ssh')(Object.assign({}, self.sshOptions, {
|
|
||||||
'host': self.host,
|
|
||||||
'port': self.port,
|
|
||||||
'username': self.username,
|
|
||||||
Generated
+3
-4
@@ -695,7 +695,6 @@ overrides:
|
|||||||
|
|
||||||
patchedDependencies:
|
patchedDependencies:
|
||||||
'@types/node-unifi': 5e6ae51e2a17a7f9729bfa30b0eb3d0842a5810ac6db47603ab4a6efa1ed84c5
|
'@types/node-unifi': 5e6ae51e2a17a7f9729bfa30b0eb3d0842a5810ac6db47603ab4a6efa1ed84c5
|
||||||
docker-modem@5.0.7: 6a79e31b826a993dfdfce5e3acc72e5f77816730fe6fb9b3c53c7fcf4570e3ec
|
|
||||||
trpc-to-openapi: 2ca3c16af0fcca0c736697ad4fe553a14f794524fa9ce0d5c3e8ee4aea76090c
|
trpc-to-openapi: 2ca3c16af0fcca0c736697ad4fe553a14f794524fa9ce0d5c3e8ee4aea76090c
|
||||||
|
|
||||||
importers:
|
importers:
|
||||||
@@ -26481,7 +26480,7 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
yaml: 2.9.0
|
yaml: 2.9.0
|
||||||
|
|
||||||
docker-modem@5.0.7(patch_hash=6a79e31b826a993dfdfce5e3acc72e5f77816730fe6fb9b3c53c7fcf4570e3ec)(supports-color@10.2.2):
|
docker-modem@5.0.7(supports-color@10.2.2):
|
||||||
dependencies:
|
dependencies:
|
||||||
debug: 4.4.3(supports-color@10.2.2)
|
debug: 4.4.3(supports-color@10.2.2)
|
||||||
readable-stream: 3.6.2
|
readable-stream: 3.6.2
|
||||||
@@ -26495,7 +26494,7 @@ snapshots:
|
|||||||
'@balena/dockerignore': 1.0.2
|
'@balena/dockerignore': 1.0.2
|
||||||
'@grpc/grpc-js': 1.12.5
|
'@grpc/grpc-js': 1.12.5
|
||||||
'@grpc/proto-loader': 0.7.13
|
'@grpc/proto-loader': 0.7.13
|
||||||
docker-modem: 5.0.7(patch_hash=6a79e31b826a993dfdfce5e3acc72e5f77816730fe6fb9b3c53c7fcf4570e3ec)(supports-color@10.2.2)
|
docker-modem: 5.0.7(supports-color@10.2.2)
|
||||||
protobufjs: 7.4.0
|
protobufjs: 7.4.0
|
||||||
tar-fs: 2.1.4
|
tar-fs: 2.1.4
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
@@ -26506,7 +26505,7 @@ snapshots:
|
|||||||
'@balena/dockerignore': 1.0.2
|
'@balena/dockerignore': 1.0.2
|
||||||
'@grpc/grpc-js': 1.12.5
|
'@grpc/grpc-js': 1.12.5
|
||||||
'@grpc/proto-loader': 0.7.13
|
'@grpc/proto-loader': 0.7.13
|
||||||
docker-modem: 5.0.7(patch_hash=6a79e31b826a993dfdfce5e3acc72e5f77816730fe6fb9b3c53c7fcf4570e3ec)(supports-color@10.2.2)
|
docker-modem: 5.0.7(supports-color@10.2.2)
|
||||||
protobufjs: 7.4.0
|
protobufjs: 7.4.0
|
||||||
tar-fs: 2.1.4
|
tar-fs: 2.1.4
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
|
|||||||
@@ -276,7 +276,6 @@ overrides:
|
|||||||
"vite@>=5.0.0 <=5.4.18": ">=8.1.4"
|
"vite@>=5.0.0 <=5.4.18": ">=8.1.4"
|
||||||
patchedDependencies:
|
patchedDependencies:
|
||||||
"@types/node-unifi": "patches/@types__node-unifi.patch"
|
"@types/node-unifi": "patches/@types__node-unifi.patch"
|
||||||
docker-modem@5.0.7: patches/docker-modem@5.0.7.patch
|
|
||||||
"trpc-to-openapi": "patches/trpc-to-openapi.patch"
|
"trpc-to-openapi": "patches/trpc-to-openapi.patch"
|
||||||
|
|
||||||
allowUnusedPatches: true
|
allowUnusedPatches: true
|
||||||
|
|||||||
Reference in new issue
Block a user