Skip to content
Merged
Changes from 1 commit
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
Next Next commit
update dependency arrays for react/exhuastive-deps
  • Loading branch information
chad1008 committed May 23, 2022
commit cdb5333edecddf5baa782d65b15be768bf34a128
10 changes: 8 additions & 2 deletions packages/components/src/border-control/border-control/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function useBorderControl(

onChange( newBorder );
},
[ onChange, shouldSanitizeBorder, sanitizeBorder ]
Copy link
Contributor

Choose a reason for hiding this comment

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

@aaronrobertshaw , do you remember if there's any particular reason why you added sanitizeBorder to the list of dependencies here?

Copy link
Contributor

Choose a reason for hiding this comment

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

🤔 Honestly can't recall and looks like I added it before tidying up local experimentation and drafting the initial PR.

I probably just had it in my head that changing sanitizeBorder would mean a changed callback. It makes sense that coming from an outer scope it isn't a valid dependency and should be removed.

[ onChange, shouldSanitizeBorder ]
);

const onWidthChange = useCallback(
Expand Down Expand Up @@ -97,7 +97,13 @@ export function useBorderControl(

onBorderChange( updatedBorder );
},
[ border, hadPreviousZeroWidth, onBorderChange ]
[
border,
hadPreviousZeroWidth,
colorSelection,
styleSelection,
onBorderChange,
]
);

const onSliderChange = useCallback(
Expand Down