Skip to content

fix(maplibre): keep credits from every replaced attribution control - #913

Merged
harlan-zw merged 1 commit into
mainfrom
fix/maplibre-attribution-credits
Sep 16, 2026
Merged

harlan-zw merged 1 commit into
mainfrom
fix/maplibre-attribution-credits

Conversation

@harlan-zw

Copy link
Copy Markdown
Collaborator

🔗 Linked issue

Follow-up to #910. This addresses the CodeRabbit finding posted on #910 two seconds after it merged. 2.0.0-beta.8 shipped without this fix.

❓ Type of change

  • 🐞 Bug fix (a non-breaking change that fixes an issue)

📚 Description

<ScriptMapLibreAttributionControl> replaces every AttributionControl on the map. It copied customAttribution only from the first replaced control.

If a map had a second attribution control with its own credits, those credits disappeared while the component was mounted. Unmounting restored them.

The component now merges the customAttribution values of all replaced controls, without duplicates. A customAttribution set on the component still replaces them.

A single inherited string now reaches MapLibre as a one-item array. MapLibre renders both forms the same way.

✅ Verification

  • A new test in test/nuxt-runtime/maplibre-controls.nuxt.test.ts failed before the fix (1 failed | 14 passed) and passes after it (15 passed).
  • pnpm lint: 0 errors. pnpm typecheck: exit 0.
  • Full suite: Test Files 118 passed, Tests 1217 passed | 6 skipped | 3 todo, Type Errors no errors.
  • test/e2e/maplibre.test.ts and test/e2e/maplibre-hydration.test.ts: Tests 10 passed (10).

Non-breaking.

Only the first replaced control's `customAttribution` carried over, so a
second attribution control lost its credits while the component was
mounted. The credits of all replaced controls are now merged.
@vercel

vercel Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
scripts-playground Ready Ready Preview Sep 16, 2026 11:05am UTC

Request Review

@pkg-pr-new

pkg-pr-new Bot commented Sep 16, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@nuxt/scripts@913

commit: afd90c6

@harlan-zw harlan-zw added the harlan-agent-running An Agent holds a Task on this issue or pull request right now. label Sep 16, 2026
@harlan-zw harlan-zw added the harlan-agent-review-required Pull request triage requires an adversarial Review for this head commit. label Sep 16, 2026
@harlan-zw

harlan-zw commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator Author

🤖 MERGED

Harlan Agent Kit posted this automated review. It is not Harlan's personal review or approval. AI open source policy. Last updated: 2026-09-16 12:47 UTC.

GitHub merged this pull request.

No material findings were recorded.

10a04fb8-081c-458d-8ba1-60b2be148ce7

@github-actions

Copy link
Copy Markdown

📦 Package Size

No notable size changes

📚 22 runtime dependencies (no change)

All tracked output (25)
Package output Gzipped Raw
@nuxt/scripts-cli · runtime dependencies 72 kB 355 kB
@nuxt/scripts-cli · dependency magicast 72 kB 355 kB
@nuxt/scripts-cli · export . 3.4 kB 12 kB
@nuxt/scripts-cli · published payload 3.4 kB 12 kB
@nuxt/scripts · runtime dependencies 436 kB 1.92 MB
@nuxt/scripts · dependency @nuxt/devtools-kit 2.9 kB 7.7 kB
@nuxt/scripts · dependency @oxc-project/types 0 B 0 B
@nuxt/scripts · dependency @vueuse/core 174 kB 707 kB
@nuxt/scripts · dependency @vueuse/shared 39 kB 154 kB
@nuxt/scripts · dependency h3 34 kB 146 kB
@nuxt/scripts · dependency semver 25 kB 72 kB
@nuxt/scripts · dependency sirv 8.8 kB 21 kB
@nuxt/scripts · dependency unstorage 70 kB 225 kB
@nuxt/scripts · dependency valibot 82 kB 590 kB
@nuxt/scripts · dist/runtime 101 kB 298 kB
@nuxt/scripts · export . 26 kB 106 kB
@nuxt/scripts · export ./registry 29 kB 90 kB
@nuxt/scripts · export ./stats 13 kB 91 kB
@nuxt/scripts · export ./types-source 47 kB 239 kB
@nuxt/scripts · published payload 216 kB 824 kB
@nuxt/scripts · components runtime 2.5 kB 6.4 kB
@nuxt/scripts · composables runtime 7.5 kB 24 kB
@nuxt/scripts · registry runtime 45 kB 133 kB
@nuxt/scripts · server runtime 29 kB 87 kB
@nuxt/scripts · utils runtime 2.5 kB 7.4 kB
Runtime dependencies (22)
Package Dependency Requested Resolved Cost
@nuxt/scripts-cli magicast ^0.5.5 0.5.5 📦 72 kB gzip
@nuxt/scripts-cli pathe ^2.0.3 2.0.3 ♻️ free via Nuxt 4.5.2
@nuxt/scripts @nuxt/devtools-kit ^3.4.2 3.4.2 📦 2.9 kB gzip
@nuxt/scripts @oxc-project/types ^0.150.0 0.150.0 📦 0 B gzip
@nuxt/scripts @vueuse/core ^14.4.0 14.4.0 📦 174 kB gzip
@nuxt/scripts @vueuse/shared ^14.4.0 14.4.0 📦 39 kB gzip
@nuxt/scripts consola ^3.4.2 3.4.2 ♻️ free via Nuxt 4.5.2
@nuxt/scripts defu ^6.1.7 6.1.7 ♻️ free via Nuxt 4.5.2
@nuxt/scripts h3 ^1.15.11 1.15.11 📦 34 kB gzip
@nuxt/scripts magic-string ^1.4.1 1.4.1 ♻️ free via Nuxt 4.5.2
@nuxt/scripts ofetch ^1.5.1 1.5.1 ♻️ free via Nuxt 4.5.2
@nuxt/scripts ohash ^2.0.12 2.0.12 ♻️ free via Nuxt 4.5.2
@nuxt/scripts oxc-walker ^1.1.1 1.1.1 ♻️ free via Nuxt 4.5.2
@nuxt/scripts pathe ^2.0.3 2.0.3 ♻️ free via Nuxt 4.5.2
@nuxt/scripts semver ^7.8.5 7.8.5 📦 25 kB gzip
@nuxt/scripts sirv ^3.0.2 3.0.2 📦 8.8 kB gzip
@nuxt/scripts std-env ^4.2.0 4.2.0 ♻️ free via Nuxt 4.5.2
@nuxt/scripts ufo ^1.6.4 1.6.4 ♻️ free via Nuxt 4.5.2
@nuxt/scripts ultrahtml ^1.7.0 1.7.0 ♻️ free via Nuxt 4.5.2
@nuxt/scripts unplugin ^3.3.0 3.3.0 ♻️ free via Nuxt 4.5.2
@nuxt/scripts unstorage ^1.17.5 1.17.5 📦 70 kB gzip
@nuxt/scripts valibot ^1.5.0 1.5.0 📦 82 kB gzip

Baseline: main_@_c9d0bcc5___2026-09-16 · gzip is the comparison metric · changes below 16 B gzip are ignored

@coderabbitai

coderabbitai Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 7a078488-512a-4f17-b42a-5fd513e74681

📥 Commits

Reviewing files that changed from the base of the PR and between c9d0bcc and afd90c6.

📒 Files selected for processing (2)
  • packages/script/src/runtime/components/MapLibre/ScriptMapLibreAttributionControl.vue
  • test/nuxt-runtime/maplibre-controls.nuxt.test.ts

Included review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review.


📝 Walkthrough

Walkthrough

The MapLibre attribution control now merges customAttribution values from all replaced controls. Duplicate credits are removed, and no credits produce undefined. Tests now expect inherited credits as arrays and verify credit merging, ordering, and restoration of replaced controls after unmount.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to afd90

The attribution changes preserve inherited credits, deduplicate them, honor component overrides, and restore replaced controls; no merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely states that the fix preserves credits from every replaced attribution control. This matches the main change.
Description check ✅ Passed The description directly explains the attribution-credit bug, the merge behavior, the regression test, and verification results. It is related to the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/maplibre-attribution-credits

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@harlan-zw harlan-zw added harlan-agent-ready The automated Review passed every gate on this head commit. harlan-agent-pending The automated Review is waiting on a gate for this head commit. and removed harlan-agent-running An Agent holds a Task on this issue or pull request right now. harlan-agent-review-required Pull request triage requires an adversarial Review for this head commit. harlan-agent-ready The automated Review passed every gate on this head commit. harlan-agent-pending The automated Review is waiting on a gate for this head commit. labels Sep 16, 2026
@harlan-zw
harlan-zw merged commit 713ebe0 into main Sep 16, 2026
16 checks passed
@harlan-zw
harlan-zw deleted the fix/maplibre-attribution-credits branch September 16, 2026 12:35
@harlan-zw harlan-zw removed the harlan-agent-ready The automated Review passed every gate on this head commit. label Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant