fix(lit-query): avoid redundant function option updates#10716
fix(lit-query): avoid redundant function option updates#10716raashish1601 wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR fixes a crash when passing function-based options to ChangesFunction-based options stability
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
The change should also be applied in |
🎯 Changes
Fixes #10715.
createQueryControllernow publishes the observer's current result after applying refreshed accessor options instead of creating a fresh optimistic result object on every Lit host update. This prevents function-style options that resolve to the same query state from scheduling redundant host updates and entering an update loop.A regression test covers the stable function-options case, and a patch changeset is included for
@tanstack/lit-query.✅ Checklist
pnpm run test:pr.🚀 Release Impact
Validation
corepack pnpm --dir packages/lit-query exec vitest run src/tests/query-controller.test.tscorepack pnpm --dir packages/lit-query run test:libcorepack pnpm --dir packages/lit-query run test:typescorepack pnpm --dir packages/lit-query run test:eslintcorepack pnpm exec prettier --check packages/lit-query/src/createQueryController.ts packages/lit-query/src/tests/query-controller.test.tscorepack pnpm --dir packages/query-core run buildcorepack pnpm --dir packages/lit-query run build:esmcorepack pnpm --dir packages/lit-query run build:cjscorepack pnpm --dir packages/lit-query run test:buildpartially passed:publint --strictandattw --packpassed; the bundled smoke script hit a Windowsspawn EINVALwhen invokingpnpm.cmd, so I manually ran the same CommonJS TypeScript smoke flow withpnpm pack,npm install, andtsc, which passed.I also attempted
corepack pnpm run test:pr, but locally it expanded to 96 projects and failed on Windows symlink placeholder files such asroot.eslint.config.jsbefore reaching this change.Summary by CodeRabbit
Bug Fixes
Tests