浏览代码

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

tags/1.8.0
Eric Guo 2 个月前
父节点
当前提交
9260aa3445
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3
    1
      web/context/web-app-context.tsx

+ 3
- 1
web/context/web-app-context.tsx 查看文件

@@ -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)

正在加载...
取消
保存