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

[LANDGRIF-1625] fixes calling /h3data endpoint wrongly when layer is raster #1235

Merged
merged 2 commits into from
Feb 25, 2025

Conversation

agnlez
Copy link
Member

@agnlez agnlez commented Feb 24, 2025

This pull request includes several changes to improve the handling of contextual layers and their data fetching in the analysis visualization components. The most important changes include the addition of a new dependency, updates to the contextual layer components, and the refactoring of hooks for better performance and maintainability.

Dependency Addition:

  • Added @lukemorales/query-key-factory to client/package.json to manage query keys more efficiently.

Contextual Layer Components:

  • Enhanced the Loading component in category-layer/component.tsx to include specific class names for better styling.
  • Updated preview-map/component.tsx to use new hooks and handle contextual layers more effectively, including adding the MapboxRasterLayer component and improving the status management of layers. [1] [2] [3]
  • Removed unused imports and hooks from contextual-legend-item/component.tsx to clean up the code. [1] [2] [3]

Hook Refactoring:

  • Refactored contextual.ts to remove the useAllContextualLayersData hook and update the useH3ContextualData hook to use the new query key store. [1] [2] [3] [4]
  • Updated index.ts to align with the new query key store and improve data fetching logic. [1] [2]
  • Removed the useContextualLayer hook from contextual.ts as it is no longer needed.

Query Key Store:

  • Introduced a new query key store in querykey-store.ts to manage query keys centrally and improve the consistency of data fetching across the application.

Application Initialization:

  • Updated _app.tsx to use a centralized query client configuration by importing getQueryClient from the new query key store. [1] [2]

@agnlez agnlez self-assigned this Feb 24, 2025
Copy link

vercel bot commented Feb 24, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
landgriffon-client ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 25, 2025 1:23pm
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
landgriffon-cookie-traceability ⬜️ Ignored (Inspect) Visit Preview 💬 Add feedback Feb 25, 2025 1:23pm
landgriffon-marketing ⬜️ Ignored (Inspect) Visit Preview Feb 25, 2025 1:23pm

@agnlez agnlez force-pushed the LANDGRIF-1625-fe-fix-preview-for-tiles-in branch 2 times, most recently from 2ae272b to 072047d Compare February 24, 2025 17:49
@agnlez agnlez changed the title [LANDGRIF-1625] fixes calling /h3data endpoint when layer is a cog [LANDGRIF-1625] fixes calling /h3data endpoint wrongly when layer is raster Feb 24, 2025
@agnlez agnlez force-pushed the LANDGRIF-1625-fe-fix-preview-for-tiles-in branch from 072047d to bb3cf70 Compare February 24, 2025 17:58
Copy link
Collaborator

@alexeh alexeh left a comment

Choose a reason for hiding this comment

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

U the man @agnlez thanks.

It works well, I haven't found my way to any weird behaviors, except this:

image

But this seems to be some internal react/next/whatever magic related to query key/caching or something that I don't understand. It does not seem to hit the backend so I leave up to your expertise what to do regarding this.

However, please, for the love of that's holy, add some tests before merging this. We can pair up to think about this. Meanwhile I will block it

@monro93 what are your thoughts? Are you up add some tests to this?

@agnlez
Copy link
Member Author

agnlez commented Feb 25, 2025

@alexeh those requests are done by the map (specifically the maplibre library) when fetches tiles. Sometimes, if the user moves quickly in the map, some requests are cancelled because they are not within the viewport anymore. This is an expected behavior, nothing harmful. (There might be other behaviors that might trigger this)

@agnlez agnlez force-pushed the LANDGRIF-1625-fe-fix-preview-for-tiles-in branch from ec147a0 to 364b184 Compare February 25, 2025 13:18
@agnlez agnlez merged commit 715f176 into dev Feb 25, 2025
8 of 9 checks passed
@agnlez agnlez deleted the LANDGRIF-1625-fe-fix-preview-for-tiles-in branch February 25, 2025 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants