perf(client): hoist the in-render dedupeFragments calls in the report screens - #4447
Open
gilgardosh wants to merge 1 commit into
Open
perf(client): hoist the in-render dedupeFragments calls in the report screens#4447gilgardosh wants to merge 1 commit into
gilgardosh wants to merge 1 commit into
Conversation
gilgardosh
temporarily deployed
to
accounter-fullstack
September 10, 2026 17:30 — with
GitHub Actions
Inactive
gilgardosh
temporarily deployed
to
accounter-fullstack
September 10, 2026 17:30 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No unresolved review comments remain, and the refactor is limited to stabilizing query documents.
Pull request overview
Hoists dedupeFragments() results to module scope in four report screens to avoid repeated document processing during renders.
Changes:
- Stabilizes query documents in four report components.
- Adds a client patch changeset.
File summaries
| File | Description |
|---|---|
packages/client/src/components/reports/vat-monthly-report/pcn-generator.tsx |
Hoists the PCN query document. |
packages/client/src/components/reports/tax-report/index.tsx |
Hoists the tax report query document. |
packages/client/src/components/reports/profit-and-loss-report/index.tsx |
Hoists the profit-and-loss query document. |
packages/client/src/components/reports/corporate-tax-ruling-compliance-report/index.tsx |
Hoists the compliance report query document. |
.changeset/urql-hoist-dedupe-fragments.md |
Documents the client patch release. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
… screens Four report screens passed `dedupeFragments(XDocument)` straight into `useQuery`. `dedupeFragments` builds a new `DocumentNode` on every call, so each render handed urql a fresh object it had to re-print and re-hash before arriving at the same operation key as last time. The tax report's document is 126 lines. Each is now a module-scope constant, matching `vat-monthly-report/index.tsx`, which already did this and carries a comment explaining why. No behaviour change: the operation key was already stable, so nothing re-keys or re-fires. This only stops the repeated work of deriving it. No test accompanies it — there is no behaviour to assert, and a test restating the refactor would be noise; the existing suite plus `stories.test.tsx`, which mounts these components, is the net. Step 6 of the urql quick-wins sequence. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TbrGL3NndzRiEwJkwHxnbm
gilgardosh
force-pushed
the
claude/urql-step-6-dedupe-fragments
branch
from
September 12, 2026 12:44
59be74d to
8a974ea
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Step 6 of 10 in the urql quick-wins sequence — tracking doc in #4437.
What changed
Four report screens passed
dedupeFragments(XDocument)straight intouseQuery:reports/tax-report/index.tsxreports/profit-and-loss-report/index.tsxreports/corporate-tax-ruling-compliance-report/index.tsxreports/vat-monthly-report/pcn-generator.tsxdedupeFragmentsbuilds a newDocumentNodeon every call, so each render handed urql a fresh object that it had to re-print and re-hash before arriving at the same operation key it had the render before. The tax report's document is 126 lines.Each is now a module-scope constant. This isn't a new convention —
vat-monthly-report/index.tsxalready did exactly this and carries a comment explaining why; the four stragglers just never got the same treatment.Scope
No behaviour change. The operation key was already stable, so nothing re-keys and no query re-fires. This only stops the repeated work of deriving that key.
No test. There's no behaviour to assert here, and a test that merely restates the refactor is noise. The net is the existing suite plus
stories.test.tsx, which mounts these components against a real urql client.I ran a full production build on this one specifically, since the change moves work to module-evaluation time.
🤖 Generated with Claude Code
https://claude.ai/code/session_01TbrGL3NndzRiEwJkwHxnbm
Generated by Claude Code