fix: some behavior for [hidden DSL] only#2510
Conversation
…ts for element attribute names
🦋 Changeset detectedLatest commit: de4f7ea The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
📝 WalkthroughWalkthroughThis PR introduces fixes and improvements to the Lynx web-core platform by skipping the Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/web-platform/web-core/ts/client/decodeWorker/decode.worker.ts (1)
343-355:⚠️ Potential issue | 🟡 MinorMinor: redundant
json.pageConfig?.cardTypein fallback.Since
configwas already spread fromjson.pageConfigon line 345,config.cardTypeis effectivelyjson.pageConfig?.cardTypeat this point. The fallback chainjson.cardType ?? json.pageConfig?.cardType ?? 'react'could be simplified tojson.cardType ?? config.cardType ?? 'react'(mirroring the pattern used forappTypeon line 353). Functionally equivalent, just tidier.Also note that
config.cardTypeis only initialized inside thelepusCode?.rootstring branch; for JSON bundles that don't match that legacy shape,cardTyperemains whatever came frompageConfig(possibly undefined). Confirm that's the intended scope givenPageConfig.cardTypeis typed as a requiredstringdownstream.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/web-platform/web-core/ts/client/decodeWorker/decode.worker.ts` around lines 343 - 355, Replace the redundant fallback expression so cardType uses the already-spread config: change the assignment config.cardType = json.cardType ?? json.pageConfig?.cardType ?? 'react' to config.cardType = json.cardType ?? config.cardType ?? 'react' inside the lepusCode.root branch; additionally, if PageConfig.cardType must always be present downstream, ensure config.cardType is initialized outside the lepusCode?.root branch (e.g., set config.cardType = config.cardType ?? json.cardType ?? 'react' immediately after spreading json.pageConfig) so non-legacy bundles receive a sensible default.
🧹 Nitpick comments (2)
packages/web-platform/web-core/ts/client/mainthread/elementAPIs/createElementAPI.ts (1)
227-232: Consistency:__UpdateComponentInfostill setslynxEntryNameAttributefor__Card__.
__CreateComponentnow skips the attribute whenentryName === '__Card__', but__UpdateComponentInfoat lines 371-373 still unconditionally setslynxEntryNameAttributewhenentryis truthy. If a caller later updates a component withentry: '__Card__', the sentinel will leak into the DOM, defeating the fix. Consider applying the same guard there (and symmetrically in the server-side API).♻️ Suggested guard for `__UpdateComponentInfo`
- if (entry) { + if (entry && entry !== '__Card__') { element.setAttribute(lynxEntryNameAttribute, entry); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/web-platform/web-core/ts/client/mainthread/elementAPIs/createElementAPI.ts` around lines 227 - 232, The update path (__UpdateComponentInfo) currently unconditionally sets lynxEntryNameAttribute when entry is truthy, which can reintroduce the '__Card__' sentinel into the DOM; modify the logic in __UpdateComponentInfo to only call dom.setAttribute(lynxEntryNameAttribute, entry) when entry is truthy AND entry !== '__Card__' (matching the guard added to __CreateComponent), and apply the same conditional on the server-side API counterpart so the '__Card__' sentinel is never written back into DOM attributes.packages/web-platform/web-core/tests/element-apis.spec.ts (1)
131-144: Optional: also cover server__CreateComponentand__UpdateComponentInfo.The new test covers the client
__CreateComponentpath only. Since the same__Card__-skip rule was mirrored ints/server/elementAPIs/createElementAPI.ts, adding an analogous assertion under the existingServer Element APIs SSR Propagationdescribe block (and for__UpdateComponentInfoif the guard is added) would prevent regressions on either side.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/web-platform/web-core/tests/element-apis.spec.ts` around lines 131 - 144, Add tests that exercise the server-side implementations to mirror the client test for dropping the '__Card__' entry name: in the existing "Server Element APIs SSR Propagation" describe block add assertions that calling the server __CreateComponent implementation (from ts/server/elementAPIs/createElementAPI.ts) returns an element whose lynxEntryNameAttribute is null when passed '__Card__', and if you add the same guard to __UpdateComponentInfo also add an analogous assertion for that function. Locate and call the server-side helpers (the server __CreateComponent and __UpdateComponentInfo functions) and assert via __GetAttributeByName that the lynxEntryNameAttribute is null to prevent regressions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.changeset/fix-card-entry-name.md:
- Line 5: Update the changeset summary to remove the stray Markdown bold markers
and use the literal sentinel string __Card__ (or escape the underscores) so it
renders correctly in release notes; locate the line containing "**Card**" in the
changeset and replace it with the literal sentinel string __Card__ (or use
escaped underscores like \_\_Card\_\_) to avoid unintended bold formatting.
---
Outside diff comments:
In `@packages/web-platform/web-core/ts/client/decodeWorker/decode.worker.ts`:
- Around line 343-355: Replace the redundant fallback expression so cardType
uses the already-spread config: change the assignment config.cardType =
json.cardType ?? json.pageConfig?.cardType ?? 'react' to config.cardType =
json.cardType ?? config.cardType ?? 'react' inside the lepusCode.root branch;
additionally, if PageConfig.cardType must always be present downstream, ensure
config.cardType is initialized outside the lepusCode?.root branch (e.g., set
config.cardType = config.cardType ?? json.cardType ?? 'react' immediately after
spreading json.pageConfig) so non-legacy bundles receive a sensible default.
---
Nitpick comments:
In `@packages/web-platform/web-core/tests/element-apis.spec.ts`:
- Around line 131-144: Add tests that exercise the server-side implementations
to mirror the client test for dropping the '__Card__' entry name: in the
existing "Server Element APIs SSR Propagation" describe block add assertions
that calling the server __CreateComponent implementation (from
ts/server/elementAPIs/createElementAPI.ts) returns an element whose
lynxEntryNameAttribute is null when passed '__Card__', and if you add the same
guard to __UpdateComponentInfo also add an analogous assertion for that
function. Locate and call the server-side helpers (the server __CreateComponent
and __UpdateComponentInfo functions) and assert via __GetAttributeByName that
the lynxEntryNameAttribute is null to prevent regressions.
In
`@packages/web-platform/web-core/ts/client/mainthread/elementAPIs/createElementAPI.ts`:
- Around line 227-232: The update path (__UpdateComponentInfo) currently
unconditionally sets lynxEntryNameAttribute when entry is truthy, which can
reintroduce the '__Card__' sentinel into the DOM; modify the logic in
__UpdateComponentInfo to only call dom.setAttribute(lynxEntryNameAttribute,
entry) when entry is truthy AND entry !== '__Card__' (matching the guard added
to __CreateComponent), and apply the same conditional on the server-side API
counterpart so the '__Card__' sentinel is never written back into DOM
attributes.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 11b47273-3189-415f-a8f9-962f7b15f41b
📒 Files selected for processing (6)
.changeset/fix-card-entry-name.md.changeset/solid-boats-lead.mdpackages/web-platform/web-core/tests/element-apis.spec.tspackages/web-platform/web-core/ts/client/decodeWorker/decode.worker.tspackages/web-platform/web-core/ts/client/mainthread/elementAPIs/createElementAPI.tspackages/web-platform/web-core/ts/server/elementAPIs/createElementAPI.ts
Merging this PR will degrade performance by 7.98%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ❌ | transform 1000 view elements |
43.1 ms | 46.8 ms | -7.98% |
Comparing PupilTong:p/hw/fix-create-component-entry-name (de4f7ea) with main (d8cdd7c)
Footnotes
-
26 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
React External#662 Bundle Size — 679.93KiB (0%).de4f7ea(current) vs 7f6fc9c main#658(baseline) Bundle metrics
|
| Current #662 |
Baseline #658 |
|
|---|---|---|
0B |
0B |
|
0B |
0B |
|
0% |
0% |
|
0 |
0 |
|
3 |
3 |
|
17 |
17 |
|
5 |
5 |
|
8.59% |
8.59% |
|
0 |
0 |
|
0 |
0 |
Bundle analysis report Branch PupilTong:p/hw/fix-create-compon... Project dashboard
Generated by RelativeCI Documentation Report issue
React Example#7544 Bundle Size — 225.23KiB (0%).de4f7ea(current) vs 7f6fc9c main#7540(baseline) Bundle metrics
|
| Current #7544 |
Baseline #7540 |
|
|---|---|---|
0B |
0B |
|
0B |
0B |
|
0% |
0% |
|
0 |
0 |
|
4 |
4 |
|
179 |
179 |
|
69 |
69 |
|
44.57% |
44.57% |
|
2 |
2 |
|
0 |
0 |
Bundle size by type no changes
| Current #7544 |
Baseline #7540 |
|
|---|---|---|
145.76KiB |
145.76KiB |
|
79.47KiB |
79.47KiB |
Bundle analysis report Branch PupilTong:p/hw/fix-create-compon... Project dashboard
Generated by RelativeCI Documentation Report issue
Web Explorer#9116 Bundle Size — 899.85KiB (-0.02%).de4f7ea(current) vs 7f6fc9c main#9112(baseline) Bundle metrics
Bundle size by type
Bundle analysis report Branch PupilTong:p/hw/fix-create-compon... Project dashboard Generated by RelativeCI Documentation Report issue |
React MTF Example#676 Bundle Size — 196.39KiB (0%).de4f7ea(current) vs 7f6fc9c main#672(baseline) Bundle metrics
|
| Current #676 |
Baseline #672 |
|
|---|---|---|
0B |
0B |
|
0B |
0B |
|
0% |
0% |
|
0 |
0 |
|
3 |
3 |
|
173 |
173 |
|
66 |
66 |
|
44.07% |
44.07% |
|
2 |
2 |
|
0 |
0 |
Bundle size by type no changes
| Current #676 |
Baseline #672 |
|
|---|---|---|
111.23KiB |
111.23KiB |
|
85.15KiB |
85.15KiB |
Bundle analysis report Branch PupilTong:p/hw/fix-create-compon... Project dashboard
Generated by RelativeCI Documentation Report issue
Summary by CodeRabbit
Release Notes
Checklist