Skip to content
Snippets Groups Projects
Commit 35c778b6 authored by David Sehnal's avatar David Sehnal
Browse files

fix use-behavior bug

parent 96f8ba5a
No related branches found
No related tags found
No related merge requests found
......@@ -19,7 +19,10 @@ export function useBehavior<T>(s: Behavior<T> | undefined): T | undefined {
const [value, setValue] = useState(s?.value);
useEffect(() => {
if (!s) return;
if (!s) {
if (value !== void 0) setValue(void 0);
return;
}
let fst = true;
const sub = s.subscribe((v) => {
if (fst) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment