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

Ej/ useMapStylesQuery hook #741

Closed
wants to merge 23 commits into from
Closed

Ej/ useMapStylesQuery hook #741

wants to merge 23 commits into from

Conversation

lightlii
Copy link
Contributor

Description

Adds two new hooks to fetch map styles using new react-query when backgroundmaps enabled, otherwise reverts to legacy api.

closes #734

@lightlii lightlii requested a review from ErikSin July 27, 2023 17:29
@lightlii lightlii changed the base branch from master to ej/zustand-store July 27, 2023 17:30
Base automatically changed from ej/zustand-store to master August 3, 2023 16:14
@ErikSin
Copy link
Contributor

ErikSin commented Aug 9, 2023

Im not really sure whats going on, but it added a bunch of unneccessary files.

Also, the hook is still not returning the correct data here.

@lightlii
Copy link
Contributor Author

lightlii commented Aug 14, 2023

Ok I've tried another way to approach this, instead of modifying the data once we've made the query I'm modifying the query itself. I can't see anywhere else we use is query so it should be ok, but if we foresee needing the full data package in the future we could pass it a transformData callback arg to the hook? Thoughs @ErikSin ?

edit: Ok so it looks like we need the rest of the data, not just the URL, makes more sense to update useLegacyMapStyleQuery... another commit incoming

@lightlii
Copy link
Contributor Author

ok I've basically mirrored how this is working on MM (probably should have looked at that sooner 🙄).

Not 100% sure about the objects beeing returned from the legacy query here and here, can you take a look?

offlineBackgroundMapName: 'Offline Map'
})

export const useMapStylesQuery = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

can you enforce the typing to `UseQueryResult<MapServerStyleInfo[]>. Both functions are returning that, but since one is not ecplicitly that, 2 different types are coming up in the ts definitions

Copy link
Contributor

@ErikSin ErikSin left a comment

Choose a reason for hiding this comment

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

Can you rebase/merge. there should only be the one file that is being checked

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.

Create new hook for list of map styles
2 participants