Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support pmtiles.Protocol.add() #93

Merged
merged 1 commit into from
Feb 17, 2025
Merged

Conversation

ciscorn
Copy link
Member

@ciscorn ciscorn commented Feb 17, 2025

Resolves #92

@ciscorn ciscorn added the enhancement New feature or request label Feb 17, 2025
@ciscorn ciscorn self-assigned this Feb 17, 2025
Copy link

pkg-pr-new bot commented Feb 17, 2025

Open in Stackblitz

npm i https://pkg.pr.new/MIERUNE/svelte-maplibre-gl@93

commit: c3b47c0

Copy link

cloudflare-workers-and-pages bot commented Feb 17, 2025

Deploying svelte-maplibre-gl with  Cloudflare Pages  Cloudflare Pages

Latest commit: c3b47c0
Status: ✅  Deploy successful!
Preview URL: https://447d6a4a.svelte-maplibre-gl.pages.dev
Branch Preview URL: https://pmtiles-protocols-add.svelte-maplibre-gl.pages.dev

View logs

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/lib/maplibre/ext/pmtiles/PMTilesProtocol.svelte (1)

38-44: Prevent potential double-inserts.

Every time pmtiles changes, you loop over them again. If Protocol.add() does not guard against duplicates, you may repeatedly add the same element. Consider deduplicating or removing pmtiles that are no longer present. Otherwise, this approach is valid.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 032efb5 and e1dae2c.

📒 Files selected for processing (1)
  • src/lib/maplibre/ext/pmtiles/PMTilesProtocol.svelte (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: preview-release
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (6)
src/lib/maplibre/ext/pmtiles/PMTilesProtocol.svelte (6)

3-3: Use imports consistently.

Great job importing Protocol and PMTiles from pmtiles. Everything here looks correct.


5-10: Consider a default for pmtiles.

Currently, pmtiles can be undefined. If you'd like to always handle an array (even if empty), you might default pmtiles to []. Otherwise, this definition looks clean.
[nirpick]


11-23: Well-documented props.

The inline documentation is clear and thoughtful. This ensures that usage is straightforward for future maintainers.


25-28: Initialize with caution.

Initializing the Protocol with { metadata, errorOnMissingTile } is correct. Ensure that any subsequent logic (like in $effect) does not inadvertently override uninitialized properties.


30-32: Reactive assignment is concise.

This reactive block updates the metadata property whenever metadata changes. This is an effective way to maintain synchronization. No issues here.


34-36: Parallel structure for errorOnMissingTile.

Similar to metadata, this keeps the protocol’s errorOnMissingTile in sync with the prop. This is straightforward and clear.

@MIERUNE MIERUNE deleted a comment from coderabbitai bot Feb 17, 2025
@ciscorn ciscorn force-pushed the pmtiles-protocols-add branch from e1dae2c to c3b47c0 Compare February 17, 2025 13:01
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 032efb5 and c3b47c0.

📒 Files selected for processing (1)
  • src/lib/maplibre/ext/pmtiles/PMTilesProtocol.svelte (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: preview-release
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (3)
src/lib/maplibre/ext/pmtiles/PMTilesProtocol.svelte (3)

2-3: LGTM! Clean and necessary imports.

The imports are well-organized and include all required dependencies for the PMTiles protocol implementation.


5-23: Well-documented props with clear type definitions!

The props are well-structured with:

  • Comprehensive JSDoc comments explaining each prop's purpose and implications
  • Appropriate default values
  • Clear TypeScript type definitions

44-44: LGTM! Clean and minimal template.

The template correctly binds the necessary props to the MapLibreProtocol component.

@MIERUNE MIERUNE deleted a comment from coderabbitai bot Feb 17, 2025
@MIERUNE MIERUNE deleted a comment from coderabbitai bot Feb 17, 2025
@ciscorn ciscorn merged commit ff701c9 into main Feb 17, 2025
6 checks passed
@ciscorn ciscorn deleted the pmtiles-protocols-add branch February 17, 2025 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose pmtiles.protocol.add() in PMTilesProtocol for local PMTiles
1 participant