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

fix(bridge-gatsby): trigger a render on search params load #1515

Open
wants to merge 1 commit into
base: development
Choose a base branch
from

Conversation

HagerDakroury
Copy link

@HagerDakroury HagerDakroury commented Apr 8, 2024

Package(s) involved

@amazeelabs/bridge-gatsby

Description of changes

  • Added a state that get updated whenever the search params are defined, in order to trigger a render on the client

Motivation and context

A common bug on PAR that got partially fixed when using react-hook-form but wasn't completely solved expect by doing a Two pass render similar to the one implemented here. The issue is also reproducible in a new project using SLB. More on PAR issue

Some resources:

Related Issue(s)

How has this been tested?

Manually with a new frontend project with SLB as a starter

@HagerDakroury HagerDakroury requested a review from pmelab April 9, 2024 08:16
@@ -14,12 +14,21 @@ export const Link: LinkType &

export const useLocation: useLocationType = () => {
const location = gatsbyUseLocation();
const [updatedSearch, setUpdatedSearch] = React.useState('');
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the search enough? What about the query fragment, can we test if that works correctly?
Otherwise we maybe should store the whole url object in the state?

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