-
Notifications
You must be signed in to change notification settings - Fork 555
Open
Labels
triageIssues to be categorized by the teamIssues to be categorized by the team
Description
🐛 Current behavior
For some weird reason, it calls the dispose() function of a custom filter connector right after the initial render. It's not supposed to do that.
Connector:
export const connectCustomFilter = (renderFn, unmountFn = noop) => {
return function customFilter(widgetParams) {
console.log('*** Custom Filter function called')
...
return {
...,
dispose({ state }) {
console.log('*** Dispose')
unmountFn();
}
}
}
}Hook:
export function useCustomFilter(props, additionalWidgetProperties = {}) {
return useConnector(
connectCustomFilter,
props,
additionalWidgetProperties
);
}Filter Component:
export default function CustomFilterComponent() {
const { ... } = useCustomFilter({ attribute});
useEffect(() => {
console.log('*** Mounted filter component')
return () => {
console.log('*** Unmounted filter component')
}
}, [])
}Console output:
*** Custom Filter function called
*** Mounted filter component
*** Custom Filter function called
*** Dispose
🔍 Steps to reproduce
The general code structure and the console output are described above.
Live reproduction
—
💭 Expected behavior
It shouldn't call the dispose() function at all because the Filter Component doesn't get unmounted at all.
Package version
react-instantsearch@^7.13.8
Operating system
No response
Browser
No response
Code of Conduct
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
triageIssues to be categorized by the teamIssues to be categorized by the team