refactor: Update shareCode in useEffect to avoid setState during render (#24468)

This commit is contained in:
Eric Guo
2025-08-25 16:14:55 +08:00
committed by GitHub
parent 6010d5f24c
commit 9260aa3445

View File

@@ -64,7 +64,9 @@ const WebAppStoreProvider: FC<PropsWithChildren> = ({ children }) => {
// Compute shareCode directly
const shareCode = getShareCodeFromRedirectUrl(redirectUrlParam) || getShareCodeFromPathname(pathname)
updateShareCode(shareCode)
useEffect(() => {
updateShareCode(shareCode)
}, [shareCode, updateShareCode])
const { isFetching, data: accessModeResult } = useGetWebAppAccessModeByCode(shareCode)
const [isFetchingAccessToken, setIsFetchingAccessToken] = useState(false)