-
Notifications
You must be signed in to change notification settings - Fork 16
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
refactor: refactor satellite view logic in useEffect #2365
base: hotfix/map-zoom-out
Are you sure you want to change the base?
Conversation
- simplified the logic for setting satellite view based on `singleProject.purpose` and `plantLocations`. - consolidated conditions to set `isSatelliteView` directly based on project purpose and plant location availability.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to work for me. Somtimes when you switch between different projects (one with default sattelite view, the other without), the switch between sattelite and map or via verse happens while the zooming is already happening, but I think that might be ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When loading a project with a lot of plant locations for the first time, the initial load shows the sat layer, once the locations have been loaded, it just switches over to the other view. Is there a way to make this at least more smoothly?
This PR refactors the logic for setting the satellite view
based on the project purpose (conservation or trees)
and theavailability of plant locations(TreeMapper Data)
. The changessimplify the useEffect hook
that previously handled these conditions and streamline the flow for determining whether the satellite view should be enabled or not.Changes:
Replaced the previous if conditions and checks for plant locations with a simplified expression.
Satellite view is now set to true for conservation purposes and when there are no plant locations for tree purposes.
The logic for determining satellite view has been consolidated, making it more readable and maintainable.
Impact:
Improves readability and clarity of the logic determining when satellite view should be enabled.
Reduces redundant conditional checks, making the code easier to maintain in the future.