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

add a flag to see if mapboxgl draw is initialized #1245

Closed
wants to merge 1 commit into from

Conversation

hanbyul-here
Copy link
Collaborator

@hanbyul-here hanbyul-here commented Nov 6, 2024

Related Ticket: {link related ticket here}

Description of Changes

This PR introduces drawToolInitialized state to useAois hook so it can be used to safely call the methods of mapboxdraw.

Notes & Questions About Changes

While refactoring, we realized that just checking if map instance has mapboxgldraw instance is not enough - this still doesn't guarantee if the store of mapboxgl.draw was initiated (which is initiated after being added to map) or not, and most of methods will throw errors if the store is not initiated.

I was wondering if there is anything that we can reliably say the mapboxgl draw store is initialized, and found the event that can be a better indicator of the store initialization - which is draw.actionable : https://github.com/mapbox/mapbox-gl-draw/blob/main/docs/API.md#drawactionable

This PR is not complete ex. draw.actionable is actually not about the initialization, it is more about what actions are currently available - so setDrawToolInitialized is getting called more than needed now. But just opening it to share the idea with the team members

Validation / Testing

This PR should not introduce any visible change to users (it should decrease the occadence that developers face on local environment)

Also I won't work on this PR for the rest of the sprint, but just wanted to push the experiment since we just put a lot of workaround for this problem.

I don't expect the review at this point, but just tagging the people who worked on AOI related problems recently @dzole0311 @AliceR @sandrahoang686

@hanbyul-here hanbyul-here changed the title add a flag to see if mapboxgl is initialized add a flag to see if mapboxgl draw is initialized Nov 6, 2024
Copy link

netlify bot commented Nov 6, 2024

Deploy Preview for veda-ui ready!

Name Link
🔨 Latest commit acc897c
🔍 Latest deploy log https://app.netlify.com/sites/veda-ui/deploys/672bc8be3029ce0008de37ba
😎 Deploy Preview https://deploy-preview-1245--veda-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@AliceR AliceR mentioned this pull request Nov 7, 2024
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