我偶然发现了通过 vercel 部署我的 next.js 应用程序。它在本地使用命令“npm run dev”完全正常。但是当我尝试使用 Github 远程存储库通过 vercel 部署它时,它会引发如下错误
18:07:58.299 Failed to compile.
18:07:58.299 ModuleNotFoundError: Module not found: Error: Can't resolve '../components/charts/be.js' in '/vercel/workpath0/my-app/pages'
18:07:58.299 > Build error occurred
18:07:58.300 Error: > Build failed because of webpack errors
18:07:58.300 at /vercel/workpath0/my-app/node_modules/next/dist/build/index.js:15:918
18:07:58.300 at processTicksAndRejections (internal/process/task_queues.js:97:5)
18:07:58.300 at async /vercel/workpath0/my-app/node_modules/next/dist/build/tracer.js:1:525
Run Code Online (Sandbox Code Playgroud)
我的be.js组件从未使用任何服务器端方法或模块,而仅使用在客户端使用的库。
18:07:58.299 Failed to compile.
18:07:58.299 ModuleNotFoundError: Module not found: Error: Can't resolve '../components/charts/be.js' in '/vercel/workpath0/my-app/pages'
18:07:58.299 > Build error occurred
18:07:58.300 Error: > Build failed because …Run Code Online (Sandbox Code Playgroud) RTK-query hook (useXXXQuery) 进行了一个查询。假设是这样useGetSomethingQuery。
我正在使用 useEffect 处理其结果对象。
const res = useGetSomethingQuery(payload);
useEffect(() => {
...
if (res.isSuccess) {
// use the fetched Data
}
},[res]);
Run Code Online (Sandbox Code Playgroud)
isSuccess正如您所看到的,当设置为时,我正在从服务器获取数据true。
首次调用该接口,状态设置为或后,isSuccess变为。换句话说,转变成后。truefulfilledrejectedisFetchingfalse
但问题是,从第二次使用同一个api开始,isSuccess属性就变成true连取都没有结束。(它的值仍然是true)。
我认为这与缓存有些关系..但不知道。
为什么要在成功之前isSuccess转向?true