Skip to content

Fetch city locations only once per website visit#5

Merged
therealJonSnow merged 1 commit intomainfrom
soeren/locations
Jun 18, 2024
Merged

Fetch city locations only once per website visit#5
therealJonSnow merged 1 commit intomainfrom
soeren/locations

Conversation

@sisou
Copy link
Copy Markdown
Contributor

@sisou sisou commented Jun 18, 2024

  • Centralize location fetching in the store, deduplicating API requests, both in code and over the wire
  • Fix filtered location requests not overwriting previous non-filtered requests: When visiting the main page, the locations for Mannheim were loaded without being filtered to enabled=true. That then set the first array entry with all locations in the store. When then navigating to Mannheim's page, locations were fetched again, but this time filtered to enabled=true and added to the store's array. But when querying the locations for a city from the store, only the first array item matching the city name was returned, which was still the unfiltered list of locations.
  • Also enable devtools in development (gives you hydration and props warnings in console)
  • Use new only_enabled=1 filter added to the Supabase function for getting city locations

- Centralize location fetching in the store, deduplicating API requests, both in code and in network requests
- Fix filtered location requests not overwriting previous non-filtered requests: When visiting the main page, the locations for Mannheim were loaded without being filtered to "enabled=true". That then set the first array entry with all locations. When then navigating to Mannheim's page, locations were fetched again, but this time filtered to "enabled=true" and added to the store's array. But when querying the locations for a city from the store, only the first array item matching the city name was returned, which was still the unfiltered list of locations.
- Also enable devtools in development (gives you hydration and props warnings in console)
- Use new `only_enabled=1` filter added to the Supabase function for getting city locations
@sisou sisou requested a review from therealJonSnow June 18, 2024 08:04
@sisou sisou self-assigned this Jun 18, 2024
@netlify
Copy link
Copy Markdown

netlify Bot commented Jun 18, 2024

Deploy Preview for kryptostadt-info ready!

Name Link
🔨 Latest commit f8060ff
🔍 Latest deploy log https://app.netlify.com/sites/kryptostadt-info/deploys/66713f87ac6d7a000899accf
😎 Deploy Preview https://deploy-preview-5--kryptostadt-info.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.

@cryptocity-network cryptocity-network deleted a comment from netlify Bot Jun 18, 2024
@cryptocity-network cryptocity-network deleted a comment from netlify Bot Jun 18, 2024
@cryptocity-network cryptocity-network deleted a comment from netlify Bot Jun 18, 2024
@cryptocity-network cryptocity-network deleted a comment from netlify Bot Jun 18, 2024
@cryptocity-network cryptocity-network deleted a comment from netlify Bot Jun 18, 2024
@therealJonSnow therealJonSnow merged commit ee75e5b into main Jun 18, 2024
@sisou sisou deleted the soeren/locations branch June 18, 2024 09:56
sisou pushed a commit that referenced this pull request Jun 18, 2024
Fetch city locations only once per website visit
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.

2 participants