Conversation
Mark `<ScriptGoogleMaps>`'s top-level `center` and `zoom` props as deprecated in favour of passing them through `mapOptions`. Both APIs keep working; the legacy form emits a dev-mode console warning. Behaviour changes: - `mapOptions.center` and `mapOptions.zoom` now take precedence over the deprecated top-level props when both are set. Previously the top-level props won (the JSDoc on `zoom` claimed precedence; defu ordering matched). The new ordering is: resolved query > mapOptions > deprecated top-level > defaults. - The `centerOverride` mechanism for resolved location queries still wins over both APIs. - The skip-if-equal `setCenter` watcher and the `setOptions` exclusion of zoom/center are untouched. Extracted `warnDeprecatedTopLevelMapProps` into `useGoogleMapsResource` so the dev-warning behaviour is unit-testable without mounting the SFC. Docs updated: deprecation tip on the API page and a v0->v1 migration section showing the before/after snippet.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
commit: |
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThis PR deprecates the top-level Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 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 B in the umbrella split-up plan).
❓ Type of change
📚 Description
Marks
<ScriptGoogleMaps>'s top-levelcenterandzoomprops as deprecated. Both APIs keep working; the legacy form emits a dev-mode console warning pointing atmapOptionsand the v0→v1 migration page. This is the first step towards consolidating map configuration on a single, idiomatic API surface.mapOptions.centerandmapOptions.zoomnow take precedence over the deprecated top-level props when both are set. Previously the top-level props won (the JSDoc onzoomclaimed precedence anddefuordering matched).The new precedence order in the
optionscomputed is:centerOverride(resolved location query) — always wins forcentermapOptions— preferred public APIcenter/zoom— legacy fallback{ zoom: 15 }If a user was setting both
:centerand:map-options="{ center: ... }", the resolved center will change. This combination is not documented and is unusual; the warning surfaces the conflict.📝 Migration
🛡 Protected behaviours
setCenterwatcher: untouchedsetOptionsexclusion ofzoom/center: untouchedcenterOverrideflow for location-query strings: untoucheddata-state: untouched🧪 Tests
Extracted
warnDeprecatedTopLevelMapPropsintouseGoogleMapsResourceso the dev-warning behaviour is unit-testable without mounting the SFC. Added 12 unit tests intest/unit/google-maps-components.test.ts:center, top-levelzoom, both, neither, explicit-undefinedmapOptions.centerwins over deprecated top-levelcentermapOptions.zoomwins over deprecated top-levelzoommapOptionslacks the corresponding keyzoom: 15fallback when nothing is setcenterOverride(resolved query) wins over both APIsAll 75 google-maps-* unit tests pass; lint and typecheck clean.