-
Notifications
You must be signed in to change notification settings - Fork 3.2k
fix: persist selection in room members page #59648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 23 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
561def7
fix: persist selection in room members page
daledah fb5f4fd
Merge branch 'main' into fix/59426
daledah 6b821e5
fix: preserve selection in other pages
daledah 944bba8
fix: lint
daledah cf6136e
Merge branch 'main' into fix/59426
daledah 4190dfa
fix: persist selection on report fields page, multi level tags page
daledah fe709dd
fix: check for exist tags
daledah c3d8f0e
Merge branch 'main' into fix/59426
daledah f1880f5
Merge branch 'main' into fix/59426
daledah 598d174
fix: create hook to unify selection persist logic
daledah 0096a98
fix: lint
daledah ebbf641
Merge branch 'main' into fix/59426
daledah 9a75daf
refactor: use array as state in usePersistSelection
daledah 568e5f1
Merge branch 'main' into fix/59426
daledah af401ee
Merge branch 'main' into fix/59426
daledah a1f1b20
fix: simplify usePersistSelection
daledah 1ad720c
fix: lint
daledah 8e43b1c
Merge branch 'main' into fix/59426
daledah 5c5fa04
fix: update suggestions
daledah 3f95d47
Merge branch 'main' into fix/59426
daledah 2a7c9bd
Merge branch 'main' into fix/59426
daledah 6bc0bf1
Merge branch 'main' into fix/59426
daledah b1fc61b
fix: apply suggestions
daledah 3d42bf2
Merge branch 'main' into fix/59426
daledah 9b40a16
fix: app crash and incorrect selected items
daledah 2bbd6be
Merge branch 'main' into fix/59426
daledah 8f0452d
fix: filter pending action for toggle all distance rates
daledah 7f1429c
Merge branch 'main' into fix/59426
daledah File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import {useEffect, useState} from 'react'; | ||
|
||
/** | ||
* Custom hook to manage a selection of keys from a given set of options. | ||
* It filters the selected keys based on a provided filter function whenever the options or the filter change. | ||
* | ||
* @param options - Option data | ||
* @param filter - Filter function | ||
* @returns A tuple containing the array of selected keys and a function to update the selected keys. | ||
*/ | ||
function useFilteredSelection<TKey extends string | number, TValue>(options: Record<TKey, TValue> | undefined, filter: (option: TValue | undefined) => boolean) { | ||
const [selectedOptions, setSelectedOptions] = useState<TKey[]>([]); | ||
|
||
useEffect(() => setSelectedOptions((prevOptions) => prevOptions.filter((key) => filter(options?.[key]))), [options, filter]); | ||
|
||
return [selectedOptions, setSelectedOptions] as const; | ||
} | ||
|
||
export default useFilteredSelection; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.