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: address search bar invisible issue in the navbar. #3452

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions components/AlgoliaSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,9 @@ export function SearchButton({ children, indexName = INDEX_NAME, ...props }: ISe
if (typeof children === 'function') {
setChildren(children({ actionKey }));
}
else {
setChildren(children);
}
Comment on lines +316 to +318
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Add missing dependency to useEffect hook

The empty dependency array prevents the effect from re-running when the children prop changes, which could cause the search bar to become invisible when the prop updates. This likely explains the issue mentioned in the PR description.

Apply this fix:

-  }, []);
+  }, [children, actionKey]);

This ensures that the search bar content updates properly when the children prop changes. The actionKey dependency is also needed since it's used within the effect.

Committable suggestion skipped: line range outside the PR's diff.

}, []);

return (
Expand Down
Loading