Skip to content

Fix linked row caches after relationship definition changes - #303

Open
dajiaohuang wants to merge 1 commit into
tinyplex:mainfrom
dajiaohuang:fix/relationships-definition-cache
Open

Fix linked row caches after relationship definition changes#303
dajiaohuang wants to merge 1 commit into
tinyplex:mainfrom
dajiaohuang:fix/relationships-definition-cache

Conversation

@dajiaohuang

Copy link
Copy Markdown

Summary

Fixes #302.

Refresh listener-backed linked-row caches when a relationship definition is recalculated. Changing either table can switch between a self-table chain and a cross-table singleton without changing any row's remote ID.

Populate existing listeners' caches before replacing table IDs so the old results remain available even after another listener cleared a shared cache. During the existing forced definition recalculation, compare refreshed results and use the existing notification set to notify affected listeners once. Ordinary store updates retain their existing path.

Adds regression cases for both transition directions, changing either table, unchanged definitions, multiple listeners, listener removal, subsequent data updates, and definition deletion. No public API, dependency, or shared-helper change.

How did you test this change?

  • Native compileForTest build and export parity: passed.
  • Relationships tests: 44 passed, 421 assertions. The four definition-transition cases fail on unpatched main.
  • Relationships implementation Istanbul coverage: 98/98 statements, 31/31 functions, 28/28 branch arms.
  • Entire native unit project: 4879 passed, two existing middleware synchronization failures. Both failures reproduce identically on a separately built, clean worktree at the same main commit (expected A, received a). Other configured test projects are not included in this count.
  • Changed-file ESLint, Prettier and git diff --check: passed.
  • Source/test/site TypeScript checks completed. The gulp ts wrapper subsequently failed spawning npx on Windows; running its two declared Svelte checks directly with the installed executable passed with zero errors and warnings.

Environment: Windows, Node.js v24.14.1. Development dependencies were shared with an existing checkout; test-only resolution overrides outside this PR ensured each run loaded the correct isolated build.

The first native build attempt encountered the existing docs-label race covered by #295; a retry passed without modifying build sources.

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.

Linked row caches stay stale when relationship table definitions change

1 participant