Skip to content

Conversation

grgbkr
Copy link
Contributor

@grgbkr grgbkr commented Jul 3, 2025

This is a follow up to: #4559

To effectively use solidjs's reconcile utility it was necessary to add a consistent identity key to every row in the view.

@grgbkr grgbkr requested a review from arv July 3, 2025 22:49
Copy link

vercel bot commented Jul 3, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
replicache-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 4, 2025 0:04am
zbugs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 4, 2025 0:04am

Copy link

github-actions bot commented Jul 3, 2025

🐰 Bencher Report

Branchgrgbkr/solid-id
TestbedLinux
Click to view all benchmark results
BenchmarkFile SizeBenchmark Result
kilobytes (KB)
(Result Δ%)
Upper Boundary
kilobytes (KB)
(Limit %)
zero-package.tgz📈 view plot
🚷 view threshold
1,211.68 KB
(+0.07%)Baseline: 1,210.86 KB
1,235.07 KB
(98.11%)
zero.js📈 view plot
🚷 view threshold
199.88 KB
(+0.05%)Baseline: 199.77 KB
203.77 KB
(98.09%)
zero.js.br📈 view plot
🚷 view threshold
56.02 KB
(+0.04%)Baseline: 56.00 KB
57.12 KB
(98.07%)
🐰 View full continuous benchmarking report in Bencher

Copy link

github-actions bot commented Jul 3, 2025

🐰 Bencher Report

Branchgrgbkr/solid-id
TestbedLinux
Click to view all benchmark results
BenchmarkThroughputBenchmark Result
operations / second (ops/s) x 1e3
(Result Δ%)
Lower Boundary
operations / second (ops/s) x 1e3
(Limit %)
src/client/custom.bench.ts > big schema📈 view plot
🚷 view threshold
395.66 ops/s x 1e3
(+10.26%)Baseline: 358.85 ops/s x 1e3
328.54 ops/s x 1e3
(83.04%)
src/client/zero.bench.ts > basics > All 1000 rows x 10 columns (numbers)📈 view plot
🚷 view threshold
1.63 ops/s x 1e3
(+2.35%)Baseline: 1.59 ops/s x 1e3
1.54 ops/s x 1e3
(94.73%)
src/client/zero.bench.ts > pk compare > pk = N📈 view plot
🚷 view threshold
30.43 ops/s x 1e3
(+0.18%)Baseline: 30.38 ops/s x 1e3
29.47 ops/s x 1e3
(96.85%)
src/client/zero.bench.ts > with filter > Lower rows 500 x 10 columns (numbers)📈 view plot
🚷 view threshold
2.61 ops/s x 1e3
(+3.62%)Baseline: 2.52 ops/s x 1e3
2.45 ops/s x 1e3
(93.71%)
🐰 View full continuous benchmarking report in Bencher

import type {Entry, Format} from './view.ts';

export const refCountSymbol = Symbol('rc');
export const idSymbol = Symbol('id');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or should this be
export const keySymbol = Symbol('key');

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really care. This is fine

expect(resultDetailsLog).toEqual([{type: 'complete'}]);
});

test('useQuery query deps change, reconcile minimizes reactive updates', async () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and the next test cases are new and verify this is giving us the precise reactive updates we want.

expect(resultDetailsLog).toEqual([{type: 'complete'}]);
resetLogs();

// eslint-disable-next-line @typescript-eslint/no-floating-promises
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why the linter is getting this wrong... this method does not return a promise.

@grgbkr
Copy link
Contributor Author

grgbkr commented Jul 3, 2025

FYI @devagrawal09

rc: number,
): RCEntry {
const id = withIDs ? makeID(row, schema) : '';
return {...row, [refCountSymbol]: rc, [idSymbol]: id};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arv I know you were concerned with polymorphic object shape. Does this look ok? Would it be ok to make the [idSymbol] optional?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we do not need to add the symbol if withIDs is false. In non SolidJS it will always be false and in SolidJS it will always be true.

@grgbkr grgbkr merged commit f103296 into main Jul 4, 2025
11 checks passed
@grgbkr grgbkr deleted the grgbkr/solid-id branch July 4, 2025 00:09
Copy link
Contributor

@arv arv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I don't think we should add the idSymbol for react. It is pretty confusing to have that there and it always being an empty string.

import type {Entry, Format} from './view.ts';

export const refCountSymbol = Symbol('rc');
export const idSymbol = Symbol('id');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really care. This is fine

rc: number,
): RCEntry {
const id = withIDs ? makeID(row, schema) : '';
return {...row, [refCountSymbol]: rc, [idSymbol]: id};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we do not need to add the symbol if withIDs is false. In non SolidJS it will always be false and in SolidJS it will always be true.

@grgbkr
Copy link
Contributor Author

grgbkr commented Jul 7, 2025

LGTM

I don't think we should add the idSymbol for react. It is pretty confusing to have that there and it always being an empty string.

Great, I will send a change to clean this up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants