Skip to content

Commit

Permalink
chore: add reset function to useFilterSphere hook
Browse files Browse the repository at this point in the history
  • Loading branch information
lawvs committed Aug 4, 2024
1 parent 70f61b1 commit 2a8d304
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/clean-moles-promise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@fn-sphere/filter": patch
---

Add new `reset` method to `useFilterSphere` hook
12 changes: 11 additions & 1 deletion packages/filter/src/hooks/use-filter-sphere.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,15 @@ export const useFilterSphere = <Data,>(props: FilterSphereInput<Data>) => {

const countTotalRules = () => countNumberOfRules(realRule);

return { filterRule: realRule, countTotalRules, getPredicate, context };
const reset = (newRule: FilterGroup = defaultRule) => {
onRuleChangeInternal(newRule);
};

return {
filterRule: realRule,
countTotalRules,
getPredicate,
reset,
context,
};
};

0 comments on commit 2a8d304

Please sign in to comment.