Conversation
…ent DX issues
- Fix OverlayView not rendering when v-model:open is not used. Vue's boolean
casting converted the missing prop to false, causing draw() to hide content.
Fixed with { default: undefined } on the model.
- Fix InfoWindow not toggling on re-click. Added isOpen state tracking so
clicking the same marker closes the InfoWindow.
- Fix opening a new InfoWindow not closing the previous one. Added shared
activateInfoWindow on MAP_INJECTION_KEY so only one InfoWindow is open at
a time within a map.
- Switch AdvancedMarkerElement click from deprecated addListener('click') to
addEventListener('gmp-click') with gmpClickable: true.
- Fix AdvancedMarkerElement emits not being registered at runtime. Changed
defineEmits from complex TS type to runtime array syntax.
- Remove broken changeQuery button from styled playground page.
- Update overlay-popup playground to use Tailwind styled card content instead
of inline styles, showcasing OverlayView's slot flexibility.
- Add regression tests for all fixes.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
commit: |
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughAdds a new Vue SFC demo Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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
🧹 Nitpick comments (1)
test/unit/google-maps-regressions.test.ts (1)
15-26: Consider strengthening the overlay model default test.The current test verifies JavaScript equality semantics (
undefined === false) rather than actual component behavior. While this documents the fix's reasoning, consider adding a component mount test that verifiesdefineModelwith{ default: undefined }actually producesundefinedwhen the prop is not provided.That said, the test serves as good regression documentation and the implementation is validated by the playground demo.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@test/unit/google-maps-regressions.test.ts` around lines 15 - 26, Add a real component mount test that verifies defineModel's default remains undefined when the prop is not provided: create a small test component that uses defineModel({ open: { default: undefined } }) (or the actual overlay component that declares v-model:open), mount it with `@vue/test-utils` without passing the open prop, and assert the resulting prop/state is strictly === undefined (e.g., wrapper.props().open === undefined or wrapper.vm.open === undefined); keep the existing explicit false assertion to confirm only an explicit false hides the overlay.
🤖 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/runtime/components/GoogleMaps/ScriptGoogleMapsInfoWindow.vue`:
- Around line 47-48: The two iw.addListener calls use concise arrow bodies with
braces that trigger the max-statements-per-line ESLint rule; change each
callback to a block-style arrow function with the assignment on its own line
(e.g., replace iw.addListener('closeclick', () => { isOpen = false }) and
iw.addListener('close', () => { isOpen = false }) with
iw.addListener('closeclick', () => { isOpen = false; }) split so the assignment
is on its own line inside the block), ensuring each line contains a single
statement and keeping references to iw, addListener, and isOpen unchanged.
---
Nitpick comments:
In `@test/unit/google-maps-regressions.test.ts`:
- Around line 15-26: Add a real component mount test that verifies defineModel's
default remains undefined when the prop is not provided: create a small test
component that uses defineModel({ open: { default: undefined } }) (or the actual
overlay component that declares v-model:open), mount it with `@vue/test-utils`
without passing the open prop, and assert the resulting prop/state is strictly
=== undefined (e.g., wrapper.props().open === undefined or wrapper.vm.open ===
undefined); keep the existing explicit false assertion to confirm only an
explicit false hides the overlay.
🪄 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: CHILL
Plan: Pro
Run ID: ce2e5da4-ee7f-41d2-a957-037b82c65cbe
📒 Files selected for processing (9)
playground/pages/third-parties/google-maps/overlay-popup.vueplayground/pages/third-parties/google-maps/styled.vuesrc/runtime/components/GoogleMaps/ScriptGoogleMaps.vuesrc/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.vuesrc/runtime/components/GoogleMaps/ScriptGoogleMapsInfoWindow.vuesrc/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.vuesrc/runtime/components/GoogleMaps/injectionKeys.tstest/unit/__mocks__/google-maps-api.tstest/unit/google-maps-regressions.test.ts
💤 Files with no reviewable changes (1)
- playground/pages/third-parties/google-maps/styled.vue
❓ Type of change
📚 Description
Several Google Maps component bugs discovered during playground testing:
OverlayView not rendering when
v-model:openis not used (e.g. withv-ifpattern). Vue's boolean casting converted the missingopenmodel prop tofalse, causingdraw()to hide the overlay. Fixed by setting{ default: undefined }on the model soundefined !== false.InfoWindow not toggling on re-click of the same marker. Added
isOpenstate tracking so clicking an already-open marker's InfoWindow closes it.InfoWindow not closing previous when opening a new one. Added shared
activateInfoWindowonMAP_INJECTION_KEYso only one InfoWindow is open at a time within a map.AdvancedMarkerElement click deprecation warning. Switched from deprecated
addListener('click')toaddEventListener('gmp-click')withgmpClickable: true.AdvancedMarkerElement emits not registered. The complex TS type in
defineEmitswasn't being extracted by the Vue SFC compiler. Changed to runtime array syntax.Also:
changeQuerybutton from styled playground page