-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
VDI: fix guest errors with community datasets (#1204)
* Handle cases w/ guest user * Allow guests to view public user datasets * Show variable tree even if variable id in url does not exist for current study * Add useValueBasedUpdater hook * Set pending state synchronously (cherry picked from commit b14db0c)
- Loading branch information
Showing
5 changed files
with
47 additions
and
26 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,12 @@ | ||
import { useRef } from 'react'; | ||
|
||
/** | ||
* Calls the `updater` function when `value` changes. | ||
*/ | ||
export function useValueBasedUpdater<T>(value: T, updater: () => void) { | ||
const ref = useRef<T>(); | ||
if (ref.current !== value) { | ||
updater(); | ||
} | ||
ref.current = value; | ||
} |
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