From dd1ee50db2e93ee007637d653f5a102ce19096b1 Mon Sep 17 00:00:00 2001 From: kirillzyusko Date: Wed, 24 Jul 2024 13:13:20 +0200 Subject: [PATCH] Revert "Revert "check: add intentionally uncompilable code to see whether action works or not"" This reverts commit df0850a04f5b688fadb999c5be5dcf6539308365. --- src/hooks/useInitialValue.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/hooks/useInitialValue.ts b/src/hooks/useInitialValue.ts index e42ea044e27a..dafd308df679 100644 --- a/src/hooks/useInitialValue.ts +++ b/src/hooks/useInitialValue.ts @@ -1,9 +1,17 @@ -import {useState} from 'react'; +import {useEffect, useState} from 'react'; +import {useSharedValue} from 'react-native-reanimated'; // In some places we set initial value on first render, but we don't want to re-run the function // This hook will memoize the initial value and return that without setter, so it's never changed // https://github.com/Expensify/App/pull/29643#issuecomment-1765894078 export default function useInitialValue(initialStateFunc: () => T) { + const a = useSharedValue(0); const [initialValue] = useState(initialStateFunc); + + useEffect(() => { + // eslint-disable-next-line react-compiler/react-compiler + a.value += 1; + }, []); + return initialValue; }