-
Notifications
You must be signed in to change notification settings - Fork 306
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* fix: violate hooks rule close gh-3108 * chore: disable type coverage in CI * chore: add comment
- Loading branch information
1 parent
ae6a607
commit 7290b73
Showing
5 changed files
with
9 additions
and
42 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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,15 +1 @@ | ||
import { ValueRef, Environment, isEnvironment } from '@dimensiondev/holoflows-kit' | ||
import { Subscription, useSubscription } from 'use-subscription' | ||
import { useMemo } from 'react' | ||
export function useValueRef<T>(ref: ValueRef<T>) { | ||
if (isEnvironment(Environment.ManifestBackground)) throw new Error('Illegal context') | ||
const subscription = useMemo<Subscription<T>>( | ||
() => ({ | ||
getCurrentValue: () => ref.value, | ||
subscribe: (callback) => ref.addListener(callback), | ||
}), | ||
[ref], | ||
) | ||
|
||
return useSubscription(subscription) | ||
} | ||
export { useValueRef } from '@dimensiondev/maskbook-shared' |
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