Skip to content

Commit

Permalink
fix __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED in taro
Browse files Browse the repository at this point in the history
  • Loading branch information
nanxiaobei committed Jan 29, 2024
1 parent 70d5b49 commit 3ce3d39
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
import { __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED } from 'react';
import { useSyncExternalStore } from 'use-sync-external-store/shim';

declare module 'react' {
var __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
ReactCurrentOwner: {
current: null | unknown;
};
};
}

type VoidFn = () => void;
type AnyFn = (...args: unknown[]) => unknown;

Expand Down Expand Up @@ -118,12 +109,9 @@ const resso = <Obj extends Record<string, unknown>>(obj: Obj): Store<Obj> => {
return obj[key];
}

if (
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner
.current !== null
) {
try {
return state[key].useSnapshot();
} else {
} catch (err) {
return obj[key];
}
}
Expand Down

0 comments on commit 3ce3d39

Please sign in to comment.