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
|
||||
*.sqlite-wal
|
||||
*.sqlite-shm
|
||||
scripts/benchmarks/analyze-*.mjs
|
||||
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
|
||||
/scripts/benchmarks/
|
||||
@@ -16,7 +16,6 @@ import {
|
||||
useSortable,
|
||||
verticalListSortingStrategy,
|
||||
} from "@dnd-kit/sortable";
|
||||
import type { ActionIconProps } from "@mantine/core";
|
||||
import { ActionIcon, Card, Center, Fieldset, Loader, Stack } from "@mantine/core";
|
||||
import { IconGripHorizontal } from "@tabler/icons-react";
|
||||
|
||||
@@ -177,21 +176,6 @@ const Item = <TItem, TOptionValue extends UniqueIdentifier>({
|
||||
id,
|
||||
});
|
||||
|
||||
const Handle = (props: Partial<ActionIconProps>) => {
|
||||
return (
|
||||
<ActionIcon
|
||||
variant="transparent"
|
||||
color="gray"
|
||||
{...props}
|
||||
{...listeners}
|
||||
ref={setActivatorNodeRef}
|
||||
style={{ cursor: "grab" }}
|
||||
>
|
||||
<IconGripHorizontal />
|
||||
</ActionIcon>
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<Card
|
||||
padding="sm"
|
||||
@@ -222,7 +206,17 @@ const Item = <TItem, TOptionValue extends UniqueIdentifier>({
|
||||
item={item}
|
||||
removeItem={removeItem}
|
||||
rootAttributes={attributes}
|
||||
handle={Handle}
|
||||
handle={
|
||||
<ActionIcon
|
||||
variant="transparent"
|
||||
color="gray"
|
||||
{...listeners}
|
||||
ref={setActivatorNodeRef}
|
||||
style={{ cursor: "grab" }}
|
||||
>
|
||||
<IconGripHorizontal />
|
||||
</ActionIcon>
|
||||
}
|
||||
/>
|
||||
</Card>
|
||||
);
|
||||
|
||||
@@ -28,11 +28,11 @@ export const { definition, componentLoader } = createWidgetDefinition("bookmarks
|
||||
openNewTab: factory.switch({ defaultValue: true }),
|
||||
withBorder: factory.switch({ defaultValue: false }),
|
||||
items: factory.sortableItemList<RouterOutputs["app"]["all"][number], string>({
|
||||
ItemComponent: ({ item, handle: Handle, removeItem, rootAttributes }) => {
|
||||
ItemComponent: ({ item, handle, removeItem, rootAttributes }) => {
|
||||
return (
|
||||
<Group {...rootAttributes} tabIndex={0} justify="space-between" wrap="nowrap">
|
||||
<Group wrap="nowrap">
|
||||
<Handle />
|
||||
{handle}
|
||||
|
||||
<Group>
|
||||
<Avatar src={item.iconUrl} alt={item.name} />
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import type React from "react";
|
||||
import type { DraggableAttributes, UniqueIdentifier } from "@dnd-kit/core";
|
||||
import type { ActionIconProps } from "@mantine/core";
|
||||
import { z } from "zod/v4";
|
||||
import type { RefinementCtx, ZodType } from "zod/v4";
|
||||
|
||||
@@ -38,7 +37,7 @@ export interface SortableItemListInput<TItem, TOptionValue extends UniqueIdentif
|
||||
item: TItem;
|
||||
removeItem: () => void;
|
||||
rootAttributes: DraggableAttributes;
|
||||
handle: (props: Partial<Pick<ActionIconProps, "size" | "color" | "variant">>) => React.ReactNode;
|
||||
handle: React.ReactNode;
|
||||
}) => React.ReactNode;
|
||||
uniqueIdentifier: (item: TItem) => TOptionValue;
|
||||
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:
|
||||
'@types/node-unifi': 5e6ae51e2a17a7f9729bfa30b0eb3d0842a5810ac6db47603ab4a6efa1ed84c5
|
||||
docker-modem@5.0.7: 6a79e31b826a993dfdfce5e3acc72e5f77816730fe6fb9b3c53c7fcf4570e3ec
|
||||
trpc-to-openapi: 2ca3c16af0fcca0c736697ad4fe553a14f794524fa9ce0d5c3e8ee4aea76090c
|
||||
|
||||
importers:
|
||||
@@ -26481,7 +26480,7 @@ snapshots:
|
||||
dependencies:
|
||||
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:
|
||||
debug: 4.4.3(supports-color@10.2.2)
|
||||
readable-stream: 3.6.2
|
||||
@@ -26495,7 +26494,7 @@ snapshots:
|
||||
'@balena/dockerignore': 1.0.2
|
||||
'@grpc/grpc-js': 1.12.5
|
||||
'@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
|
||||
tar-fs: 2.1.4
|
||||
transitivePeerDependencies:
|
||||
@@ -26506,7 +26505,7 @@ snapshots:
|
||||
'@balena/dockerignore': 1.0.2
|
||||
'@grpc/grpc-js': 1.12.5
|
||||
'@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
|
||||
tar-fs: 2.1.4
|
||||
transitivePeerDependencies:
|
||||
|
||||
@@ -276,7 +276,6 @@ overrides:
|
||||
"vite@>=5.0.0 <=5.4.18": ">=8.1.4"
|
||||
patchedDependencies:
|
||||
"@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"
|
||||
|
||||
allowUnusedPatches: true
|
||||
|
||||
Reference in new issue
Block a user