ApolloClient 缓存不会存储每个项目

时间:2021-07-20 16:27:21

标签: react-native apollo-client apollo-cache-inmemory

我有 ApolloClient 缓存问题。有一些项目没有存储在缓存中。

环境:React Native

包:

  • @apollo/client
  • @react-native-async-storage/async-storage
  • apollo3-cache-persist

结果(无缓存):

import tkinter as tk
import tkinter.ttk as ttk

#DICTIONARIES#
materialDict = {"": {"town": 0, "street": 0},
                "Belgium": {"town": "Brussels", "street": "red_boulevard"},
                "Germany": {"town": "Bremen", "street": "green_boulevard"}}


#FUNCTION#

def selected(func):
    a = materialDict [main.get()]["town"]
    town.set(a)
    c = materialDict [main.get()]["street"]
    street.set(c)


#WINDOWLOOP#
root = tk.Tk()
root.geometry("250x125")

#VARIABLES#

main = tk.StringVar()
town = tk.StringVar()
street = tk.StringVar()


#COMBOBOXES#
combobox = ttk.Combobox(root, height=5, state="readonly", values=list(materialDict.keys()), textvariable=main)
combobox.place(x=10, y=10, width=130)
combobox.bind('<<ComboboxSelected>>', func=selected)


#LABELS#
town_label = tk.Label(root, text='town:')
town_label.place(x=150, y=10, width=70, height=20)

street_label = tk.Label(root, text='street:')
street_label.place(x=150, y=70, width=70, height=20)

town_label1 = tk.Label(root, textvariable=town)
town_label1.place(x=155, y=30, width=100, height=20)

street_label1 = tk.Label(root, textvariable=street)
street_label1.place(x=155, y=90, width=100, height=20)


root.mainloop()

结果(带缓存:策略:缓存优先)

contentElements: [{
  __typename: "My_Stage",
  cta: {label: "Test", link: "mylink", __typename: "CTA"},
  id: "0123234234234234234234",
}]

我不认为这是规范化的问题,因为元素有 contentElements: [{ __typename: "My_Stage", }] id。 我还尝试使用 __typenamekeyFields: false 禁用规范化,但这不起作用。

如果我没有提供足够的信息,请告诉我。感谢您的帮助!

0 个答案:

没有答案