Police-Data-Accessibility-Project / pdap.io

Static HTML front page
https://pdap.io
MIT License
1 stars 2 forks source link

bug: quick search from dev environment #169

Closed josh-chamberlain closed 7 months ago

josh-chamberlain commented 7 months ago

Context

When I quick search from data-sources.pdap.dev, I get sent to a dev url: https://data-sources.pdap.dev/search/complaints/all

When I quick search from pdap.dev, I get sent to a prod url: https://data-sources.pdap.io/search/complaints/all

This makes it possible to accidentally mess up while you're trying to test stuff on dev.

Requirements

Open questions

josh-chamberlain commented 7 months ago

@joshuagraber your thoughts?

joshuagraber commented 7 months ago

@joshuagraber your thoughts?

Hey @josh-chamberlain, should be an easy fix. The QuickSearchForm component accepts a prop mode that will adjust the base URL. We would just need to pass "dev" or "prod" conditionally to the form when we render it. We may want to add an accepted local value as well, to search on localhost when developing locally.

It is a bit bizarre that the behavior is different... That prop defaults to "prod". Edit: not bizarre at all. The logic first checks for the route to include /search, and if it does, we simply navigate via the router. Because the form is rendered on /search/... in data-sources but not in pdap.io—and this is happening because we need to leave the pdap.io app to route to the data-sources app—that explains the difference. An easy fix regardless.

I'm ill today and taking the day off to rest, but I can look into this and get a quick PR up tomorrow when I'm back online.