Browse Source

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

tags/1.8.0
Eric Guo 2 months ago
parent
commit
9260aa3445
No account linked to committer's email address
1 changed files with 3 additions and 1 deletions
  1. 3
    1
      web/context/web-app-context.tsx

+ 3
- 1
web/context/web-app-context.tsx 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)

Loading…
Cancel
Save