1

我正在尝试改用 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 | })

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

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, cache, fetchExchange],
    })
4

0 回答 0