React Apollo -GraphQl文件未更新/反映更改

发布于 2025-01-30 16:45:39 字数 261 浏览 4 评论 0原文

我正在将React应用程序升级到第18版,它仍在进行中,但是我面临着GraphQl查询的怪异行为。我正在使用React Apollo来管理所有前端存储数据和GraphQl宏来加载所有GraphQl文件。每当我们对 *.gql进行任何更改时,也更早。我们过去曾在CRA配置中默认观看(热重新加载)这些文件,但即使我已经进行了任何更改,添加或删除了GQL查询/突变中的任何字段,因此这些文件不在CRA配置中。我的应用程序仍在尝试加载以前的查询。即使重新启动服务器也无济于事。有时候它有效,大多数情况下它不起作用。

I am upgrading my react app to version 18, its still in progress but i am facing a weird behaviour with graphql queries. I am using React Apollo to manage all the frontend store data and graphql macro to load all graphql files. Earlier also every time we make any changes in *.gql. We used to restart the server as those files are not by default watched(hot reload) in CRA config but currently even if i had made any changes, added or removed any fields from gql query/mutations. My application is still trying to load the previous queries. Even restarting the server is not helping. Sometime it works and most of the time it does not work.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我早已燃尽 2025-02-06 16:45:39

我能够通过清除node_modules生成的缓存来解决此问题。另外,我还通过附加缓存Clear命令来更新开始脚本。

"scripts": {
  "start": "rm -rf ./node_modules/.cache/babel-loader && react-scripts start",
}

参考 -

I was able to resolve this problem by clearing the cache which was being generated in node_modules. Also i have updated the start script by appending the cache clear command.

"scripts": {
  "start": "rm -rf ./node_modules/.cache/babel-loader && react-scripts start",
}

Reference - Clean Create React App's cache when importing graphql files

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文