Skip to content

Bugfix: Fix missing showRoadNames#544

Merged
matbmapspeople merged 8 commits intomainfrom
bugfix/url_props_not_working
Jul 3, 2025
Merged

Bugfix: Fix missing showRoadNames#544
matbmapspeople merged 8 commits intomainfrom
bugfix/url_props_not_working

Conversation

@matbmapspeople
Copy link
Copy Markdown
Collaborator

@matbmapspeople matbmapspeople commented Jun 25, 2025

What: It was discovered that miTransitionLevel and showRoadNames props are not working.
In meantime I discovered that minZoom level also was not working.

It was due to brandingColor overriding those values.

How:
I made a dedicated useEffect that sets all values at the same time.

Summary by CodeRabbit

  • Refactor
    • Streamlined map options management for smoother and more consistent updates.
    • Enhanced handling of color and map display settings to improve reliability.
    • Improved numeric handling for map view parameters to ensure consistent behavior.
  • Chores
    • Removed unused callback properties and related logic from the map wrapper component.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jun 25, 2025

Walkthrough

The changes refactor how map option state is managed and propagated between the MapTemplate and MapWrapper components. State synchronization and updates now occur internally within MapTemplate using a useEffect hook, while the callback and related props for map option changes have been removed from both components. Additionally, numeric casting is added for pitch, bearing, and zoom level parameters in the useMapBoundsDeterminer hook.

Changes

File(s) Change Summary
packages/map-template/src/components/MapTemplate/MapTemplate.jsx Refactored to update map options via a useEffect hook based on relevant state/prop changes; removed callback logic and handler; updated how primary color is captured.
packages/map-template/src/components/MapWrapper/MapWrapper.jsx Removed onMapOptionsChange prop, related prop types, and recoil state subscriptions; deleted associated useEffect hooks.
packages/map-template/src/hooks/useMapBoundsDeterminer.js Updated goTo function to cast pitch, bearing, and zoomLevel arguments to numbers before applying map transformations.

Poem

In the garden of code, states realign,
Map options now sync on their own sweet time.
Callbacks retired, effects take the stage,
Colors and names set neatly on page.
Rabbits rejoice as the logic grows clean—
Hopping through maps, with a codebase serene! 🗺️🐇


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between b8fa427 and 62175aa.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (1)
  • packages/map-template/CHANGELOG.md (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/map-template/CHANGELOG.md

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown
Contributor

@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)
packages/map-template/src/components/MapTemplate/MapTemplate.jsx (1)

150-150: Consider consistent variable naming.

The destructured variable is named color while the setter is setPrimaryColor. For better readability, consider using consistent naming:

-    const [color, setPrimaryColor] = useRecoilState(primaryColorState);
+    const [primaryColor, setPrimaryColor] = useRecoilState(primaryColorState);

This would also require updating the dependency in the useEffect on line 489.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 5e512c7 and ea7e8f1.

📒 Files selected for processing (2)
  • packages/map-template/src/components/MapTemplate/MapTemplate.jsx (2 hunks)
  • packages/map-template/src/components/MapWrapper/MapWrapper.jsx (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/map-template/src/components/MapTemplate/MapTemplate.jsx (5)
packages/map-template/src/constants/zoomLevelValues.js (2)
  • ZoomLevelValues (1-3)
  • ZoomLevelValues (1-3)
packages/map-template/src/components/Directions/Directions.jsx (1)
  • primaryColor (80-80)
packages/map-template/src/components/LocationDetails/LocationDetails.jsx (1)
  • primaryColor (83-83)
packages/map-template/src/components/Wayfinding/Wayfinding.jsx (1)
  • primaryColor (85-85)
packages/map-template/src/components/QRCodeDialog/QRCodeDialog.jsx (1)
  • primaryColor (17-17)
🔇 Additional comments (2)
packages/map-template/src/components/MapWrapper/MapWrapper.jsx (1)

62-62: LGTM! Simplified component interface.

The removal of the onMapOptionsChange callback parameter aligns with the centralized state management approach implemented in MapTemplate.jsx. This simplification reduces the coupling between components.

packages/map-template/src/components/MapTemplate/MapTemplate.jsx (1)

483-489: ```shell
#!/bin/bash

Search for primaryColorState usage across JS and JSX files

rg -A3 -B3 "primaryColorState" --glob ".js" --glob ".jsx"

Search for recoil hook usage in MapTemplate component

rg -A3 -B3 "useRecoil" packages/map-template/src/components/MapTemplate/MapTemplate.jsx

Search for primaryColor prop references in MapTemplate

rg -n "primaryColor" -A3 -B3 packages/map-template/src/components/MapTemplate/MapTemplate.jsx


</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

@matbmapspeople
Copy link
Copy Markdown
Collaborator Author

@ammapspeople I pushed a small fix. It was discovered that Google Maps does not like when startZoomLevel is not explicitly type of Number. I fixed that.

Copy link
Copy Markdown
Contributor

@ammapspeople ammapspeople left a comment

Choose a reason for hiding this comment

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

It's a nice cleanup. We should however test the affected props thoroughly and in as many possible combinations as possible.

Co-authored-by: Anders Mogensen <am@mapspeople.com>
@matbmapspeople
Copy link
Copy Markdown
Collaborator Author

It's a nice cleanup. We should however test the affected props thoroughly and in as many possible combinations as possible.

I will prepare some proper test cases once the merge request is approved 😄

Copy link
Copy Markdown
Contributor

@ammapspeople ammapspeople left a comment

Choose a reason for hiding this comment

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

👍

@matbmapspeople matbmapspeople merged commit 53bed60 into main Jul 3, 2025
1 check passed
@matbmapspeople matbmapspeople deleted the bugfix/url_props_not_working branch July 3, 2025 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants