This repository has been archived by the owner on Dec 19, 2024. It is now read-only.
InstantSearch: Render facets with URL from environment on the server #505
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We were having problems where the HTML page returned from the Vercel SSR included facet links pointing at the Vercel subdomain where it's actually hosted, instead of at
www.ifixit.com
. This switches things around to use the host fromNEXT_PUBLIC_IFIXIT_ORIGIN
when rendering on the server, which means that we're in full control of where the code thinks its origin is.I didn't handle the case where
NEXT_PUBLIC_IFIXIT_ORIGIN
has a path on it; it doesn't seem currently relevant, and it's kinda a change from the previous behavior (which breaks up thelocation
and uses it to generate the new URL; the path is handled separately).QA Notes
Check the page source on https://react-commerce-prod-git-instant-search-use-correc-eb6415-ifixit.vercel.app/Parts/Mac (use the
View Source
function in your browser; the inspector won't show what you need), search forAdhesive
in the source, and verify that thehref
on thea
tag you should find makes sense. If you're not sure, you should be able to try the same thing on https://react-commerce-prod.vercel.app/Parts/Mac and see how the output is different.The thing you're searching for should look a bit like this:
![image](https://user-images.githubusercontent.com/1283490/181139506-6c64bc25-07d2-4a99-b584-b5250828abf2.png)
I'm a little unsure about why the branch preview version seems to have
www.cominor.com
configured as the server URL forreact-commerce-prod
, but given that it also doesn't seem to have all the products I'd have expected, I'm guessing it's not using a real prod config, despite the name.Fixes ifixit/ifixit#43961