♻️(frontend) support legacy and new widget attribute#650
Conversation
The new widget loader consume `window._lasuite_widget` property to know which widget to load. The previous version was using `window._stmsg_header`. We refactor widget loading logic to support both version with ease.
5297af0 to
5870861
Compare
📝 WalkthroughWalkthroughThe PR introduces a new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 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 docstrings
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
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/frontend/src/features/utils/widget-helper.ts`:
- Around line 24-35: loadScript currently early-returns when there is no
existing <script> tag (firstScript), causing widgets to never load on pages
without preexisting scripts; update loadScript (function loadScript, parameter
scriptUrl, local var firstScript) to append the created script to document.head
or document.body when firstScript is null instead of doing nothing—i.e., if
firstScript and firstScript.parentNode use insertBefore(script, firstScript),
otherwise appendChild to document.head || document.body so the script is always
added.
🪄 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: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 6cb12785-6e58-4f9c-97e3-402940b673e9
📒 Files selected for processing (4)
src/frontend/src/features/ui/components/feedback-button/index.tsxsrc/frontend/src/features/ui/components/feedback-widget/index.tsxsrc/frontend/src/features/ui/components/lagaufre/index.tsxsrc/frontend/src/features/utils/widget-helper.ts
Purpose
The new widget loader consume
window._lasuite_widgetproperty to know which widget to load. The previous version was usingwindow._stmsg_header. We refactor widget loading logic to support both version with ease.Summary by CodeRabbit