Skip to content

Commit

Permalink
Fixes #30650 - fixed linter error in HOC.js
Browse files Browse the repository at this point in the history
  • Loading branch information
yifatmakias authored and sharvit committed Aug 17, 2020
1 parent b15d6a9 commit 4a61ebc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions webpack/assets/javascripts/react_app/common/HOC.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ export const callOnMount = callback => WrappedComponent => componentProps => {
* assuming the component has withRouter
* @param {Function} callback - function to run
*/
export const callOnPopState = callback => WrappedComponent => props => {
export const callOnPopState = callback => WrappedComponent => componentProps => {
const didMount = useRef(false);
const {
history: { action },
location: { search },
} = props;
} = componentProps;
useEffect(() => {
if (action === 'POP' && didMount.current) {
callback(props);
callback(componentProps);
} else {
didMount.current = true;
}
}, [search, action]);

return <WrappedComponent {...props} />;
return <WrappedComponent {...componentProps} />;
};

/**
Expand Down

0 comments on commit 4a61ebc

Please sign in to comment.