切换到urql offlineExchange时遇到问题;运行时错误:类型错误:无法读取未定义的属性“长度”

问题描述

我正在尝试改用 urql offlineExchange。

出现以下错误

    <!-- language: lang-none -->
    TypeError: Cannot read property 'length' of undefined
    ha

    https://rdududevw10sdn.dsa.int:3443/static/js/0.chunk.js:23933:10
    Module../src/index.js
    E:/CCase/sdickerson_wfm14216_view/AnsosWeb/WSM/Application/app/src/index.js:33
      30 |     optimistic: {},31 | });
      32 | 
    > 33 | const client = createClient({
      34 |     url: WSM_URL,35 |     exchanges: [dedupExchange,cache,fetchExchange],36 | })

我正在尝试遵循离线支持文档 (Offline Support.

index.js:

    const WSM_URL = '/api/gql'
    
    const introspectedSchema = {
        __schema: {
            queryType: {name: 'Query',},mutationType: {name: 'Mutation',subscriptionType: {name: 'Subscription',}
    
    const storage = makeDefaultStorage({
        idbname: 'graphcache-v3',// The name of the IndexedDB database
        maxAge: 7,// The maximum age of the persisted data in days
    })
    
    const cache = offlineExchange({
        schema: introspectedSchema,storage,updates: {},optimistic: {},});
    
    const client = createClient({
        url: WSM_URL,exchanges: [dedupExchange,})

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)