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

Create new hook for list of map styles #734

Open
2 tasks
ErikSin opened this issue Jul 5, 2023 · 0 comments
Open
2 tasks

Create new hook for list of map styles #734

ErikSin opened this issue Jul 5, 2023 · 0 comments
Assignees

Comments

@ErikSin
Copy link
Contributor

ErikSin commented Jul 5, 2023

When Background Maps is enabled, we want the list of map styles to be to be from useMapServerQuery('styles') hook. When Background Maps is NOT enabled, we want the list of available styles to come from the logic found in MapStyleProvider. Technically the api in MapStyleProvider only provides a single item, but we will maintain it as an array to be consistent with useMapServerQuery('styles'). We are also moving towards tanstack query for all API calls. Create a custom hook (called useLegacyMapServerQuery), using tanstack, to make the API calls. Then create another hook, that returns the results from useMapServerQuery or the results from useLegacyMapServerQuery, based on whether the feature flag is on.

To Do:

  • Create new hook 'useLegacyMapServerQuery'. Using Tanstack, call the api calls in Map Style Provider
  • Create new hook useMapStyles() that returns the results from useMapServerQuery('/styles') or useLegacyMapServerQuery depending on feature flag. The useMapServerQuery('/styles') returns a list of MapServerStyleInfo, but we only want to save the url into the list that is being returned. useMapStyles() should return string[]
@ErikSin ErikSin changed the title Refactor Map Style Provider Create new hook for list of map styles Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🏗 In progress
Development

Successfully merging a pull request may close this issue.

2 participants