-
Notifications
You must be signed in to change notification settings - Fork 1
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
fix(404): add button for searches #869
Conversation
1. duplicate infobar to not found layout 2. export styles from infobar so it's kept in sync 3. add client component for search button
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
packages/components/src/templates/next/layouts/NotFound/SearchButton.tsx
Outdated
Show resolved
Hide resolved
packages/components/src/utils/__tests__/getWordsFromPermalink.test.ts
Outdated
Show resolved
Hide resolved
packages/components/src/templates/next/layouts/NotFound/SearchButton.tsx
Outdated
Show resolved
Hide resolved
const [permalink, setPermalink] = useState("") | ||
|
||
useLayoutEffect(() => { | ||
// The check for typeof window and navigator ensures this only runs in browser environments, not during server-side rendering |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will never be server-side rendered due to "use client" declarative at top
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not server-side rendered but nextjs will transpile then serve the js at runtime. this led to compile errors as window
is undefined
when transpiling
@@ -0,0 +1,15 @@ | |||
export const getWordsFromPermalink = (permalink: string): string => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
checking understanding:
so https://example.com/some-page_name+ will yield some+page+name
right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeap excatly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We know that this comes from the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after digging more into nextjs, it seems like entering /search/?q=abc
doesn't work (incorrectly redirected by our CF to /search
) but clicking on the button rendered by nextjs does not go through our CF redirect so this still works.
i think we don't have to update our CF since we don't have to support people typing /search/?q=abc
for now
nevertheless, have logged them into https://linear.app/ogp/issue/ISOM-1680/aws-cloudfront-function-does-not-handle-edge-case for future work
Problem
on the 404 page, users are not able to take action to self-resolve the issue
Solution