(subscribe, getSnapshot, getServerSnapshot)
| 24889 | return [newState, dispatch]; |
| 24890 | } |
| 24891 | function mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { |
| 24892 | var fiber = currentlyRenderingFiber$1, |
| 24893 | hook = mountWorkInProgressHook(); |
| 24894 | if (isHydrating) { |
| 24895 | if (void 0 === getServerSnapshot) |
| 24896 | throw Error( |
| 24897 | "Missing getServerSnapshot, which is required for server-rendered content. Will revert to client rendering." |
| 24898 | ); |
| 24899 | var nextSnapshot = getServerSnapshot(); |
| 24900 | didWarnUncachedGetSnapshot || |
| 24901 | nextSnapshot === getServerSnapshot() || |
| 24902 | (console.error( |
| 24903 | "The result of getServerSnapshot should be cached to avoid an infinite loop" |
| 24904 | ), |
| 24905 | (didWarnUncachedGetSnapshot = !0)); |
| 24906 | } else { |
| 24907 | nextSnapshot = getSnapshot(); |
| 24908 | didWarnUncachedGetSnapshot || |
| 24909 | ((getServerSnapshot = getSnapshot()), |
| 24910 | objectIs(nextSnapshot, getServerSnapshot) || |
| 24911 | (console.error( |
| 24912 | "The result of getSnapshot should be cached to avoid an infinite loop" |
| 24913 | ), |
| 24914 | (didWarnUncachedGetSnapshot = !0))); |
| 24915 | if (null === workInProgressRoot) |
| 24916 | throw Error( |
| 24917 | "Expected a work-in-progress root. This is a bug in React. Please file an issue." |
| 24918 | ); |
| 24919 | 0 !== (workInProgressRootRenderLanes & 60) || |
| 24920 | pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot); |
| 24921 | } |
| 24922 | hook.memoizedState = nextSnapshot; |
| 24923 | getServerSnapshot = { value: nextSnapshot, getSnapshot: getSnapshot }; |
| 24924 | hook.queue = getServerSnapshot; |
| 24925 | mountEffect( |
| 24926 | subscribeToStore.bind(null, fiber, getServerSnapshot, subscribe), |
| 24927 | [subscribe] |
| 24928 | ); |
| 24929 | fiber.flags |= 2048; |
| 24930 | pushEffect( |
| 24931 | HasEffect | Passive, |
| 24932 | updateStoreInstance.bind( |
| 24933 | null, |
| 24934 | fiber, |
| 24935 | getServerSnapshot, |
| 24936 | nextSnapshot, |
| 24937 | getSnapshot |
| 24938 | ), |
| 24939 | { destroy: void 0 }, |
| 24940 | null |
| 24941 | ); |
| 24942 | return nextSnapshot; |
| 24943 | } |
| 24944 | function updateSyncExternalStore( |
| 24945 | subscribe, |
| 24946 | getSnapshot, |
no test coverage detected
searching dependent graphs…