reactjs - 不能在阿波罗突变的更新方法中使用等待
问题描述
我正在尝试更新缓存以触发 UI 的重新渲染,但update
如果您使用 apollo 突变的方法似乎无法正常工作async/await
mutation({
variables: {
...
},
update: async (cache, responseFromMutation) => {
...
const someFunctionResult = await someFunction()
proxy.writeQuery({...}) // this writes to cache but doesn't trigger rerendering of UI. If we take out the `await` it works.
}
})
有任何想法吗?
解决方案
推荐阅读
- python - Tor 活动链接状态检查器
- mysql - 如何解决连接过多
- geckodriver - Geckodriver Selenium/Java 无法在 macOS Big Sur 上运行
- azure - 在 signin_signup 自定义策略中 EnforceIdTokenHintOnLogout="true" 时出现 Azure AD B2C 错误“未指定 id_token_hint 参数”
- android - 为什么我不能使用 asyncTask
- python - 如何在角图中以不同方式格式化中位数和误差?
- javascript - chart.js 我们如何提取点击的变量?
- python - 电子邮件发送但在python中未收到
- elixir - 如何在 Elixir Ecto 中使用动态比较运算符?
- nginx-reverse-proxy - 使用 nginx 为每个位置提供不同的静态文件夹