fix(google-maps): prevent center reset on re-render and export clusterer types#686
fix(google-maps): prevent center reset on re-render and export clusterer types#686
Conversation
…rer types Skip setCenter when lat/lng are unchanged to prevent user pan position from resetting on unrelated re-renders (defu creates new object refs). Extract marker clusterer types into a standalone file and re-export from #nuxt-scripts/types for easier user access. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
commit: |
|
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 (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR moves Google Maps marker-clustering TypeScript interfaces and the Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 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 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 |
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. 🤖 Generated with Claude Code |
Re-exports from <script> don't create local bindings in <script setup>, causing TS2304 errors. Import types locally then re-export separately. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
`@packages/script/src/runtime/components/GoogleMaps/ScriptGoogleMapsMarkerClusterer.vue`:
- Around line 6-7: Move the import that brings in Cluster, ClusterStats,
MarkerClustererContext, MarkerClustererInstance, MarkerClustererOptions so it
appears before the import of ./useGoogleMapsResource, and ensure the import of
MARKER_CLUSTERER_INJECTION_KEY is separated from the exports by a single blank
line; specifically, reorder the import containing those type symbols and add one
blank line after the MARKER_CLUSTERER_INJECTION_KEY import so lint ordering and
spacing rules pass.
🪄 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: 4ec24956-b001-4683-b881-b0f1e4623389
📒 Files selected for processing (1)
packages/script/src/runtime/components/GoogleMaps/ScriptGoogleMapsMarkerClusterer.vue
| import type { Cluster, ClusterStats, MarkerClustererContext, MarkerClustererInstance, MarkerClustererOptions } from './types' | ||
| import { MARKER_CLUSTERER_INJECTION_KEY } from './types' |
There was a problem hiding this comment.
Fix import ordering and spacing to unblock lint checks.
Line 6 should be ordered before the ./useGoogleMapsResource import, and Line 7 should be followed by a blank line before the exports on Line 8.
💡 Suggested diff
import { getCurrentInstance, h, inject, onBeforeUnmount, provide, shallowRef, useSlots, render as vueRender, watch } from 'vue'
+import type { Cluster, ClusterStats, MarkerClustererContext, MarkerClustererInstance, MarkerClustererOptions } from './types'
+import { MARKER_CLUSTERER_INJECTION_KEY } from './types'
import { bindGoogleMapsEvents, MAP_INJECTION_KEY, useGoogleMapsResource } from './useGoogleMapsResource'
// Import types locally (needed for <script setup> scope) and re-export for backwards compat
-import type { Cluster, ClusterStats, MarkerClustererContext, MarkerClustererInstance, MarkerClustererOptions } from './types'
-import { MARKER_CLUSTERER_INJECTION_KEY } from './types'
+
export type { Cluster, ClusterStats, MarkerClustererContext, MarkerClustererInstance, MarkerClustererOptions }
export { MARKER_CLUSTERER_INJECTION_KEY }🧰 Tools
🪛 ESLint
[error] 6-6: Expected "./types" (type-sibling) to come before "./useGoogleMapsResource" (value-sibling).
(perfectionist/sort-imports)
[error] 7-7: Expected 1 empty line after import statement not followed by another import.
(import/newline-after-import)
🪛 GitHub Check: lint
[failure] 7-7:
Expected 1 empty line after import statement not followed by another import
[failure] 6-6:
Expected "./types" (type-sibling) to come before "./useGoogleMapsResource" (value-sibling)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In
`@packages/script/src/runtime/components/GoogleMaps/ScriptGoogleMapsMarkerClusterer.vue`
around lines 6 - 7, Move the import that brings in Cluster, ClusterStats,
MarkerClustererContext, MarkerClustererInstance, MarkerClustererOptions so it
appears before the import of ./useGoogleMapsResource, and ensure the import of
MARKER_CLUSTERER_INJECTION_KEY is separated from the exports by a single blank
line; specifically, reorder the import containing those type symbols and add one
blank line after the MARKER_CLUSTERER_INJECTION_KEY import so lint ordering and
spacing rules pass.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
setCenterwhen lat/lng are unchanged to prevent user pan position from resetting on unrelated re-renders (defu creates new object refs)Cluster,ClusterStats, etc.) into a standalone file and re-export from#nuxt-scripts/typesfor easier user accessTest plan
🤖 Generated with Claude Code