-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: improve home refresh logic (#202)
## Description Closes: #XXXX This PR improves the home refresh logic using a global flag that tells if the home should reload the data. This is a temporary workaround untill we have a proper application wide cache. --- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* - [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] provided a link to the relevant issue or specification - [x] reviewed "Files changed" and left comments if necessary - [x] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed all author checklist items have been addressed
- Loading branch information
Showing
7 changed files
with
75 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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 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,23 @@ | ||
import { atom, useRecoilValue, useSetRecoilState } from 'recoil'; | ||
|
||
/** | ||
* Recoil that holds a boolean flag that tells if the home should | ||
* be refreshed. | ||
* NOTE: This is a workaround to force the home to refresh until we have | ||
* a proper cache in place that can be updated after an operation that | ||
* affect the data displayed in the Home screen. | ||
*/ | ||
const homeShouldReloadData = atom<boolean>({ | ||
key: 'homeShouldReloadData', | ||
default: false, | ||
}); | ||
|
||
/** | ||
* Hook that tels if the home should refresh the displayed data. | ||
*/ | ||
export const useHomeShouldReloadData = () => useRecoilValue(homeShouldReloadData); | ||
|
||
/** | ||
* Hook that provides a function to update the value of the refresh home flag. | ||
*/ | ||
export const useSetHomeShouldReloadData = () => useSetRecoilState(homeShouldReloadData); |
This file contains 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 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 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 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 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