refactor(google-maps)!: rename googleMaps expose to mapsApi#695
refactor(google-maps)!: rename googleMaps expose to mapsApi#695
Conversation
Rename the template-ref expose key on `<ScriptGoogleMaps>` from `googleMaps` to `mapsApi`. The old key is preserved as a deprecated alias backed by an accessor that fires a one-shot dev-mode warning, so existing template-ref consumers keep working without breakage. `<ScriptGoogleMapsOverlayView>` gets the same treatment: `overlay` becomes `overlayView`, with `overlay` retained as a deprecated alias. Implementation: - Added `defineDeprecatedAlias` helper in `useGoogleMapsResource` that swaps a data property for an accessor with a one-shot warning - Both call sites wrap the helper in `if (import.meta.dev)` so production builds skip the getter entirely and the alias remains a plain data property pointing at the canonical ref - The `ready` event payload still uses `ScriptGoogleMapsExpose`, so consumers gain `mapsApi` as an additive property without breakage Docs updated: template-ref API table now lists `mapsApi` first and marks `googleMaps` as deprecated; v0->v1 migration guide gains a section showing the rename for both `<ScriptGoogleMaps>` and `<ScriptGoogleMapsOverlayView>`.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
commit: |
|
Caution Review failedPull request was closed or merged during review No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThis pull request refactors the Google Maps component API by renaming two exposed template-ref keys to improve naming clarity. The Estimated code review effort🎯 3 (Moderate) | ⏱️ ~30 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
🔗 Linked issue
Related to #689 (PR C in the umbrella split-up plan).
❓ Type of change
📚 Description
Renames the template-ref expose key on
<ScriptGoogleMaps>fromgoogleMapstomapsApi, which more accurately reflects what it holds (thegoogle.mapsAPI namespace, not the component itself). The old key is preserved as a deprecated alias backed by an accessor that fires a one-shot dev-mode warning, so existing template-ref consumers keep working without breakage.<ScriptGoogleMapsOverlayView>gets the same treatment:overlaybecomesoverlayView, withoverlayretained as a deprecated alias.Strictly speaking this is an additive change in dev mode (both keys still work) and an additive change in prod mode (both keys still work). The breaking-change marker is conservative because:
ScriptGoogleMapsExpose/ScriptGoogleMapsOverlayViewExposeis nowmapsApi/overlayView. TypeScript users who annotatedScriptGoogleMapsExposedirectly may see new required-property errors if they construct the object themselves. The interface still includes the old keys as deprecated, so destructuring patterns (const { googleMaps } = exposed) still typecheck.📝 Migration
const mapRef = ref() onMounted(() => { - console.log(mapRef.value?.googleMaps) + console.log(mapRef.value?.mapsApi) })const overlayRef = ref() onMounted(() => { - console.log(overlayRef.value?.overlay) + console.log(overlayRef.value?.overlayView) })🛠 Implementation notes
defineDeprecatedAliashelper inuseGoogleMapsResourcethat replaces a data property with an accessor that fires a one-shot warningif (import.meta.dev), so production builds skip the getter entirely and the alias stays a plain data property pointing at the canonical ref. No runtime overhead in prod.readyevent payload still usesScriptGoogleMapsExpose, so consumers gainmapsApias an additive property without breakage.🛡 Protected behaviours
All v1 protected behaviours are untouched:
setCenterwatchersetOptionsexclusion ofzoom/centerdefineModel('open', { default: undefined })on OverlayViewdata-stateattribute🧪 Tests
Added 9 unit tests in
test/unit/google-maps-components.test.tscovering both renames:All 84 google-maps-* unit tests pass; lint and typecheck clean.