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

Fetch region config from API #388

Merged
merged 8 commits into from
Nov 15, 2024
Merged

Fetch region config from API #388

merged 8 commits into from
Nov 15, 2024

Conversation

graue
Copy link
Contributor

@graue graue commented Oct 30, 2024

Closes #293.

Fetches region-specific information from an API endpoint, instead of having it hardcoded for the SF Bay in the frontend.

This actually works OK and could be shipped, but before doing so, I would like to figure out how to change the config on the server, and tweak a few things about the API shape.

Up till now, information from the region config has been expected to be available at module import time, which is no longer the case. This is why lib/region will now export getter functions instead of constants, and why the viewport reducer and store initialization have changed slightly.

I'm using Zod to ensure the format of the region config is what we expect. Now that we're almost all TypeScript, it would be good to introduce this for other APIs.

To-do list before merging:

Copy link
Contributor

@Andykmcc Andykmcc left a comment

Choose a reason for hiding this comment

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

this looks good but i haven't tested it

src/components/DirectionsNullState.tsx Show resolved Hide resolved
src/lib/region.ts Show resolved Hide resolved
To fix:
- Redux type errors deriving from generating the store later than import type
  (necessary because default viewport bounds aren't fetched yet)
- Default viewport being bad for UX, too zoomed out, need manual override
@graue graue marked this pull request as ready for review November 15, 2024 05:37
@graue graue changed the title WIP: Fetch region config from API Fetch region config from API Nov 15, 2024
@graue graue merged commit c84eb9c into main Nov 15, 2024
3 checks passed
@graue graue deleted the graue/region-api branch November 15, 2024 05:42
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.

Be able to fetch region-specific info from API
2 participants