Skip to content

Commit

Permalink
fix(react-instantsearch): index added twice with Next.js app router (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
aymeric-giraudet committed Mar 27, 2024
1 parent bc5122f commit 1778b31
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/react-instantsearch-core/src/lib/useWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export function useWidget<TWidget extends Widget | IndexWidget, TProps>({

// Scenario 1: the widget is added for the first time.
if (!cleanupTimerRef.current) {
if (!shouldAddWidgetEarly) {
if (!shouldSsr) {
parentIndex.addWidgets([widget]);
}
}
Expand Down Expand Up @@ -85,7 +85,7 @@ export function useWidget<TWidget extends Widget | IndexWidget, TProps>({
});
});
};
}, [parentIndex, widget, shouldAddWidgetEarly, search, props]);
}, [parentIndex, widget, shouldSsr, search, props]);

if (
shouldAddWidgetEarly ||
Expand Down

0 comments on commit 1778b31

Please sign in to comment.