init#659
Conversation
|
Important Review skippedToo many files! This PR contains 168 files, which is 18 over the limit of 150. To get a review, narrow the scope: ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (168)
You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThis PR implements the Changeswalker init command implementation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/web/sources/browser/src/translation.ts`:
- Around line 147-150: The isDomScope type guard is too permissive by checking
only for 'body' or 'tagName' keys; update it to reliably detect real DOM nodes
by verifying the runtime types instead (e.g., use instanceof Element or
instanceof Document when available, and as a fallback check nodeType === 1 for
elements or nodeType === 9 for documents). Modify the isDomScope function to
first ensure value is non-null object and then return true only when it
satisfies the robust DOM checks (Element/Document instanceof or nodeType checks)
so plain objects with tagName/body properties no longer pass as DOM scopes.
In `@website/docs/sources/web/browser/index.mdx`:
- Around line 92-93: The example calls elb('walker init',
document.querySelector('`#app`')) without guarding for a null DOM node; change the
snippet so you first query the element (document.querySelector('`#app`')) and only
pass it to elb('walker init', element) if the element is non-null (otherwise
fall back to omitting the element or using a safe default), ensuring the example
is null-safe and does not silently no-op when '`#app`' is missing.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: dc813866-cd9c-405f-a6ef-2b67ef9b6754
📒 Files selected for processing (7)
.changeset/walker-init-fix.mdpackages/web/sources/browser/src/__tests__/command-coverage.test.tspackages/web/sources/browser/src/__tests__/commands.test.tspackages/web/sources/browser/src/index.tspackages/web/sources/browser/src/translation.tspackages/web/sources/browser/src/types/index.tswebsite/docs/sources/web/browser/index.mdx
| elb('walker init', document.querySelector('#app')); | ||
| elb('product view', { id: 'P123' }); // Also tracks events`} |
There was a problem hiding this comment.
Make the example null-safe to avoid silent no-op.
document.querySelector('#app') may be null; guarding it keeps the snippet reliable for users.
💡 Proposed fix
-// Browser source elb: Enhanced with DOM commands
-elb('walker init', document.querySelector('`#app`'));
+// Browser source elb: Enhanced with DOM commands
+const appRoot = document.querySelector('`#app`');
+if (appRoot) elb('walker init', appRoot);
elb('product view', { id: 'P123' }); // Also tracks events🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@website/docs/sources/web/browser/index.mdx` around lines 92 - 93, The example
calls elb('walker init', document.querySelector('`#app`')) without guarding for a
null DOM node; change the snippet so you first query the element
(document.querySelector('`#app`')) and only pass it to elb('walker init', element)
if the element is non-null (otherwise fall back to omitting the element or using
a safe default), ensuring the example is null-safe and does not silently no-op
when '`#app`' is missing.
Preview deployed |
|
🚀 Stable release published Packages Install: 🐳 Docker images published
Docker: |
Summary by CodeRabbit
Bug Fixes
walker initso it correctly initializes a given scope (element(s) or document), rescans for initialization tags, and emits load events for SPA/infinite-scroll scenarios.Documentation
walker initto show passing a DOM scope directly.Tests