: \n}\n\nexport default Foo;"],"hast":[0,{"type":[0,"root"],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"pre"],"properties":[0,{"class":[1,[[0,"shiki"],[0,"shiki-themes"],[0,"github-light-default"],[0,"houston"],[0,"p-4"],[0,"rounded-b-md"],[0,"max-w-96"]]],"style":[0,"background-color:#F2F4F4;--shiki-dark-bg:#0D171C;color:#546461;--shiki-dark:#B4C0BE; font-variant-ligatures: none;"],"tabindex":[0,"0"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"code"],"properties":[0,{}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"1"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#5C95B2"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"import"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," { "]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"useApolloClient"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," } "]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#5C95B2"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"from"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7D6800;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," '@apollo/client'"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,";"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"2"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"3"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#5C95B2"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"function"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7B00C7;--shiki-dark:#00FAB3"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," Foo"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," (){"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"4"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#5C95B2"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," const"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," ["]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#365E72;--shiki-dark:#ACAFFF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"reset"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,", "]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#365E72;--shiki-dark:#ACAFFF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"setReset"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"] "]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"="]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7B00C7;--shiki-dark:#00FAB3"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," useState"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"("]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#365E72;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"0"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,");"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"5"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#5C95B2"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," const"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#365E72;--shiki-dark:#ACAFFF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," client"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," ="]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7B00C7;--shiki-dark:#00FAB3"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," useApolloClient"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"();"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"6"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"7"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7B00C7;--shiki-dark:#00FAB3"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," useEffect"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"(() "]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#5C95B2"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"=>"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," {"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[1,[[0,"line"],[0,"bg-gray-100"],[0,"dark:bg-navy-450"]]]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"8"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#5C95B2"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," const"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#365E72;--shiki-dark:#ACAFFF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," unsubscribe"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," ="]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," client"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"."]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7B00C7;--shiki-dark:#00FAB3"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"onResetStore"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"(() "]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#5C95B2"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"=>"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[1,[[0,"line"],[0,"bg-gray-100"],[0,"dark:bg-navy-450"]]]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"9"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#5C95B2"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," new"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#365E72;--shiki-dark:#ACAFFF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," Promise"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"(()"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#5C95B2"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"=>"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7B00C7;--shiki-dark:#00FAB3"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"setReset"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"("]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"reset"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," +"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#365E72;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," 1"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"))"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[1,[[0,"line"],[0,"bg-gray-100"],[0,"dark:bg-navy-450"]]]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"10"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," );"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"11"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"12"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#5C95B2"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," return"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," () "]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#5C95B2"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"=>"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," {"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[1,[[0,"line"],[0,"bg-gray-100"],[0,"dark:bg-navy-450"]]]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"13"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7B00C7;--shiki-dark:#00FAB3"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," unsubscribe"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"();"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"14"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," };"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"15"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," });"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"16"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"17"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#5C95B2"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," return"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," reset"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#5C95B2"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," ?"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," <"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#116329;--shiki-dark:#5C95B2"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"div"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," /> "]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#5C95B2"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,":"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," <"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#116329;--shiki-dark:#5C95B2"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"span"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," />"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"18"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"}"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"19"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"20"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#5C95B2"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"export"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#5C95B2"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," default"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," Foo"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,";"]}]]]}]]]}]]]}]]]}]]]}]}]]]}]}],"majorComponent":[0,true],"divWrap":[0,true]}]}],[0,{"type":[0,"heading"],"depth":[0,2],"children":[1,[[0,{"type":[0,"text"],"value":[0,"TypePolicy inheritance"]}]]],"data":[0,{"collapseMargin":[0,false]}]}],[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"JavaScript developers will be familiar with the idea of "]}],[0,{"type":[0,"link"],"title":[0,null],"url":[0,"https://en.m.wikipedia.org/wiki/Inheritance_(object-oriented_programming)"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"inheritance"]}]]]}],[0,{"type":[0,"text"],"value":[0," from the "]}],[0,{"type":[0,"inlineCode"],"value":[0,"extends"]}],[0,{"type":[0,"text"],"value":[0," clause of "]}],[0,{"type":[0,"inlineCode"],"value":[0,"class"]}],[0,{"type":[0,"text"],"value":[0," declarations, or possibly from dealing with prototype chains created by "]}],[0,{"type":[0,"inlineCode"],"value":[0,"Object.create"]}],[0,{"type":[0,"text"],"value":[0,"."]}]]]}],[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"Inheritance is a powerful code-sharing tool, and it works well with "]}],[0,{"type":[0,"text"],"value":[0,"Apollo Client"]}],[0,{"type":[0,"text"],"value":[0," for several reasons:"]}]]]}],[0,{"type":[0,"list"],"ordered":[0,false],"start":[0,null],"spread":[0,true],"children":[1,[[0,{"type":[0,"listItem"],"spread":[0,false],"checked":[0,null],"children":[1,[[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"inlineCode"],"value":[0,"InMemoryCache"]}],[0,{"type":[0,"text"],"value":[0," already knows about the supertype-subtype relationships ("]}],[0,{"type":[0,"emphasis"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"interfaces and unions"]}]]]}],[0,{"type":[0,"text"],"value":[0,") in your schema, thanks to "]}],[0,{"type":[0,"inlineCode"],"value":[0,"possibleTypes"]}],[0,{"type":[0,"text"],"value":[0,", so no additional configuration is necessary to provide that information."]}]]]}]]]}],[0,{"type":[0,"listItem"],"spread":[0,false],"checked":[0,null],"children":[1,[[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"Inheritance allows a supertype to provide default configuration values to all its subtypes, including "]}],[0,{"type":[0,"inlineCode"],"value":[0,"keyFields"]}],[0,{"type":[0,"text"],"value":[0," and individual "]}],[0,{"type":[0,"text"],"value":[0,"field"]}],[0,{"type":[0,"text"],"value":[0," policies, which can be selectively overridden by subtypes that want something different."]}]]]}]]]}],[0,{"type":[0,"listItem"],"spread":[0,false],"checked":[0,null],"children":[1,[[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"A single subtype can have multiple supertypes in a "]}],[0,{"type":[0,"term"],"text":[0,"GraphQL schema,"],"term":[0,{"name":[0,"graphql schema"],"definition":[0,"A GraphQL schema defines the structure and types of data that can be queried or mutated, serving as a contract between the server and clients."],"frontmatter":[0,{"labels":[1,[[0,"GraphQL"]]],"exampleUsage":[0,"Your **GraphQL schema** defines the structure of the data available to your GraphQL server."],"internalOnly":[0,false],"learnMore":[0,"https://graphql.com/learn/schema/"],"learnMoreText":[0,"Learn more about GraphQL schemas"]}]}],"children":[1,[[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"A GraphQL schema defines the structure and types of data that can be queried or mutated, serving as a contract between the server and clients."]}]]]}],[0,{"type":[0,"link"],"url":[0,"https://graphql.com/learn/schema/"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"Learn more about GraphQL schemas."]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0," which is difficult to model using the single inheritance model of classes or prototypes. In other words, supporting multiple inheritance in JavaScript requires building a system something like this one, rather than just reusing built-in language features."]}]]]}]]]}],[0,{"type":[0,"listItem"],"spread":[0,false],"checked":[0,null],"children":[1,[[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"Developers can add their own client-only supertypes to the "]}],[0,{"type":[0,"inlineCode"],"value":[0,"possibleTypes"]}],[0,{"type":[0,"text"],"value":[0," map, as a way of reusing behavior across types, even if their schema knows nothing about those supertypes."]}]]]}]]]}],[0,{"type":[0,"listItem"],"spread":[0,false],"checked":[0,null],"children":[1,[[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"The "]}],[0,{"type":[0,"inlineCode"],"value":[0,"possibleTypes"]}],[0,{"type":[0,"text"],"value":[0," map is currently used only for "]}],[0,{"type":[0,"term"],"text":[0,"fragment"],"term":[0,{"name":[0,"fragment"],"definition":[0,"A selection set of fields that can be shared between multiple query operations. For example:\n\n```graphql\nfragment UserData on User {\n id: ID!\n firstName: String!\n lastName: String!\n}\n\nquery GetUsers {\n allUsers {\n ...UserData\n }\n}\n```"],"frontmatter":[0,{"labels":[1,[[0,"GraphQL"]]],"internalOnly":[0,false],"learnMore":[0,"https://graphql.com/learn/interfaces-and-unions/#fragments"],"learnMoreText":[0,"Learn more about fragments"]}]}],"children":[1,[[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"A selection set of fields that can be shared between multiple query operations. For example:"]}]]]}],[0,{"type":[0,"mdxJsxFlowElement"],"name":[0,"CodeBlockHTML"],"attributes":[1,[]],"children":[1,[]],"data":[0,{"props":[0,{"json":[0,{"tabs":[1,[[0,{"lang":[0,"graphql"],"disableCopy":[0,false],"showLineNumbers":[0,true],"code":[0,"fragment UserData on User {\n id: ID!\n firstName: String!\n lastName: String!\n}\n\nquery GetUsers {\n allUsers {\n ...UserData\n }\n}"],"hast":[0,{"type":[0,"root"],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"pre"],"properties":[0,{"class":[1,[[0,"shiki"],[0,"shiki-themes"],[0,"github-light-default"],[0,"houston"],[0,"p-4"],[0,"rounded-b-md"],[0,"max-w-96"]]],"style":[0,"background-color:#F2F4F4;--shiki-dark-bg:#0D171C;color:#546461;--shiki-dark:#B4C0BE; font-variant-ligatures: none;"],"tabindex":[0,"0"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"code"],"properties":[0,{}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"1"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#5C95B2"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"fragment"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#B03900;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," UserData"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#5C95B2"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," on"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#365E72;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," User"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," {"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"2"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7D6800;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," id"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,": "]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#B03900;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"ID"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"!"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"3"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7D6800;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," firstName"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,": "]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#B03900;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"String"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"!"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"4"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7D6800;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," lastName"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,": "]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#B03900;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"String"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"!"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"5"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"}"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"6"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"7"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#5C95B2"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"query"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7B00C7;--shiki-dark:#00FAB3"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," GetUsers"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," {"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"8"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#B03900;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," allUsers"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," {"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"9"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," ..."]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#B03900;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"UserData"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"10"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," }"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"11"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"}"]}]]]}]]]}]]]}]]]}]]]}]}]]]}]}],"majorComponent":[0,true],"divWrap":[0,true]}]}],[0,{"type":[0,"link"],"url":[0,"https://graphql.com/learn/interfaces-and-unions/#fragments"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"Learn more about fragments."]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0," matching purposes, which is an important but fairly small part of what the client does. Inheritance adds another compelling use for "]}],[0,{"type":[0,"inlineCode"],"value":[0,"possibleTypes"]}],[0,{"type":[0,"text"],"value":[0,", and should drastically reduce repetition of "]}],[0,{"type":[0,"inlineCode"],"value":[0,"typePolicies"]}],[0,{"type":[0,"text"],"value":[0," when used effectively."]}]]]}]]]}]]]}],[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"Here's how type policy inheritance works for "]}],[0,{"type":[0,"inlineCode"],"value":[0,"InMemoryCache"]}],[0,{"type":[0,"text"],"value":[0,", considering the example below:"]}]]]}],[0,{"type":[0,"mdxJsxFlowElement"],"name":[0,"CodeBlockHTML"],"attributes":[1,[]],"children":[1,[]],"data":[0,{"props":[0,{"json":[0,{"tabs":[1,[[0,{"lang":[0,"ts"],"disableCopy":[0,false],"showLineNumbers":[0,true],"code":[0,"const cache = new InMemoryCache({\n possibleTypes: {\n Reptile: [\"Snake\", \"Turtle\"],\n Snake: [\"Python\", \"Viper\", \"Cobra\"],\n Viper: [\"Cottonmouth\", \"DeathAdder\"],\n },\n\n typePolicies: {\n Reptile: {\n // Suppose all our reptiles are captive, and have a tag with an ID.\n keyFields: [\"tagId\"],\n fields: {\n // Scientific name-related logic can be shared among Reptile subtypes.\n scientificName: {\n merge(_, incoming) {\n // Normalize all scientific names to lower case.\n return incoming.toLowerCase();\n },\n },\n },\n },\n\n Snake: {\n fields: {\n // Default to a truthy non-boolean value if we don't know\n // whether this snake is venomous.\n venomous(status = \"unknown\") {\n return status;\n },\n },\n },\n },\n});"],"hast":[0,{"type":[0,"root"],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"pre"],"properties":[0,{"class":[1,[[0,"shiki"],[0,"shiki-themes"],[0,"github-light-default"],[0,"houston"],[0,"p-4"],[0,"rounded-b-md"],[0,"max-w-96"]]],"style":[0,"background-color:#F2F4F4;--shiki-dark-bg:#0D171C;color:#546461;--shiki-dark:#B4C0BE; font-variant-ligatures: none;"],"tabindex":[0,"0"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"code"],"properties":[0,{}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"1"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#5C95B2"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"const"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#365E72;--shiki-dark:#ACAFFF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," cache"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," ="]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#5C95B2"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," new"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7B00C7;--shiki-dark:#00FAB3"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," InMemoryCache"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"({"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"2"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," possibleTypes"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,": {"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"3"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," Reptile"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,": ["]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7D6800;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"\"Snake\""]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,", "]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7D6800;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"\"Turtle\""]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"],"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"4"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," Snake"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,": ["]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7D6800;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"\"Python\""]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,", "]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7D6800;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"\"Viper\""]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,", "]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7D6800;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"\"Cobra\""]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"],"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"5"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," Viper"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,": ["]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7D6800;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"\"Cottonmouth\""]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,", "]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7D6800;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"\"DeathAdder\""]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"],"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"6"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," },"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"7"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"8"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," typePolicies"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,": {"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"9"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," Reptile"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,": {"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"10"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#6E7781;font-style:inherit;--shiki-dark:#EEF0F98F;--shiki-dark-font-style:italic"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," // Suppose all our reptiles are captive, and have a tag with an ID."]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"11"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," keyFields"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,": ["]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7D6800;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"\"tagId\""]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"],"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"12"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," fields"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,": {"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"13"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#6E7781;font-style:inherit;--shiki-dark:#EEF0F98F;--shiki-dark-font-style:italic"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," // Scientific name-related logic can be shared among Reptile subtypes."]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"14"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," scientificName"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,": {"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"15"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7B00C7;--shiki-dark:#00FAB3"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," merge"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"("]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#B03900;font-style:inherit;--shiki-dark:#7DC0FF;--shiki-dark-font-style:italic"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"_"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,", "]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#B03900;font-style:inherit;--shiki-dark:#7DC0FF;--shiki-dark-font-style:italic"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"incoming"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,") {"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"16"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#6E7781;font-style:inherit;--shiki-dark:#EEF0F98F;--shiki-dark-font-style:italic"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," // Normalize all scientific names to lower case."]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"17"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#5C95B2"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," return"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," incoming"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"."]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7B00C7;--shiki-dark:#00FAB3"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"toLowerCase"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"();"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"18"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," },"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"19"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," },"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"20"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," },"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"21"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," },"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"22"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"23"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," Snake"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,": {"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"24"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," fields"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,": {"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"25"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#6E7781;font-style:inherit;--shiki-dark:#EEF0F98F;--shiki-dark-font-style:italic"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," // Default to a truthy non-boolean value if we don't know"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"26"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#6E7781;font-style:inherit;--shiki-dark:#EEF0F98F;--shiki-dark-font-style:italic"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," // whether this snake is venomous."]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"27"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7B00C7;--shiki-dark:#00FAB3"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," venomous"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"("]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#B03900;font-style:inherit;--shiki-dark:#7DC0FF;--shiki-dark-font-style:italic"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"status"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," ="]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7D6800;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," \"unknown\""]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,") {"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"28"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#5C95B2"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," return"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," status"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,";"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"29"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," },"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"30"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," },"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"31"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," },"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"32"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," },"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"33"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"});"]}]]]}]]]}]]]}]]]}]]]}]}]]]}]}],"majorComponent":[0,true],"divWrap":[0,true]}]}],[0,{"type":[0,"heading"],"depth":[0,2],"children":[1,[[0,{"type":[0,"text"],"value":[0,"Refetching queries after a mutation"]}]]],"data":[0,{"collapseMargin":[0,false]}]}],[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"In certain cases, writing an "]}],[0,{"type":[0,"inlineCode"],"value":[0,"update"]}],[0,{"type":[0,"text"],"value":[0," function to "]}],[0,{"type":[0,"link"],"title":[0,null],"url":[0,"https://www.apollographql.com/docs/react/data/mutations/#updating-local-data"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"update the cache after a mutation"]}]]]}],[0,{"type":[0,"text"],"value":[0," can be complex, or even impossible if the "]}],[0,{"type":[0,"text"],"value":[0,"mutation"]}],[0,{"type":[0,"text"],"value":[0," doesn't return modified "]}],[0,{"type":[0,"text"],"value":[0,"fields."]}]]]}],[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"In these cases, you can provide a "]}],[0,{"type":[0,"inlineCode"],"value":[0,"refetchQueries"]}],[0,{"type":[0,"text"],"value":[0," option to the "]}],[0,{"type":[0,"inlineCode"],"value":[0,"useMutation"]}],[0,{"type":[0,"text"],"value":[0," hook to automatically rerun certain queries after the "]}],[0,{"type":[0,"text"],"value":[0,"mutation"]}],[0,{"type":[0,"text"],"value":[0," completes."]}]]]}],[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"For details, see "]}],[0,{"type":[0,"link"],"title":[0,null],"url":[0,"https://www.apollographql.com/docs/react/data/mutations/#refetching-queries"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"Refetching queries"]}]]]}],[0,{"type":[0,"text"],"value":[0,"."]}]]]}],[0,{"type":[0,"mdxJsxFlowElement"],"name":[0,"Note"],"attributes":[1,[]],"children":[1,[[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"Although "]}],[0,{"type":[0,"inlineCode"],"value":[0,"refetchQueries"]}],[0,{"type":[0,"text"],"value":[0," can be faster to implement than an "]}],[0,{"type":[0,"inlineCode"],"value":[0,"update"]}],[0,{"type":[0,"text"],"value":[0," function, it also requires additional network requests that are usually undesirable. For more information, see "]}],[0,{"type":[0,"link"],"title":[0,null],"url":[0,"https://www.apollographql.com/blog/when-to-use-refetch-queries/"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"this blog post"]}]]]}],[0,{"type":[0,"text"],"value":[0,"."]}]]],"data":[0,{"passthroughRender":[0,true]}]}]]],"data":[0,{"props":[0,{}],"majorComponent":[0,false],"divWrap":[0,true]}]}],[0,{"type":[0,"heading"],"depth":[0,2],"children":[1,[[0,{"type":[0,"text"],"value":[0,"Cache redirects"]}]]],"data":[0,{"collapseMargin":[0,false]}]}],[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"In some cases, a "]}],[0,{"type":[0,"text"],"value":[0,"query"]}],[0,{"type":[0,"text"],"value":[0," requests data that already exists in the cache under a different reference. For example, your UI might have a list view and a detail view that both use the same data."]}]]]}],[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"The list view might run the following "]}],[0,{"type":[0,"text"],"value":[0,"query:"]}]]]}],[0,{"type":[0,"mdxJsxFlowElement"],"name":[0,"CodeBlockHTML"],"attributes":[1,[]],"children":[1,[]],"data":[0,{"props":[0,{"json":[0,{"tabs":[1,[[0,{"lang":[0,"graphql"],"disableCopy":[0,false],"showLineNumbers":[0,true],"code":[0,"query Books {\n books {\n id\n title\n abstract\n }\n}"],"hast":[0,{"type":[0,"root"],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"pre"],"properties":[0,{"class":[1,[[0,"shiki"],[0,"shiki-themes"],[0,"github-light-default"],[0,"houston"],[0,"p-4"],[0,"rounded-b-md"],[0,"max-w-96"]]],"style":[0,"background-color:#F2F4F4;--shiki-dark-bg:#0D171C;color:#546461;--shiki-dark:#B4C0BE; font-variant-ligatures: none;"],"tabindex":[0,"0"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"code"],"properties":[0,{}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"1"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#5C95B2"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"query"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7B00C7;--shiki-dark:#00FAB3"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," Books"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," {"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"2"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#B03900;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," books"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," {"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"3"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#B03900;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," id"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"4"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#B03900;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," title"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"5"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#B03900;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," abstract"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"6"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," }"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"7"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"}"]}]]]}]]]}]]]}]]]}]]]}]}]]]}]}],"majorComponent":[0,true],"divWrap":[0,true]}]}],[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"When a specific book is selected, the detail view might display an individual item using this "]}],[0,{"type":[0,"text"],"value":[0,"query:"]}]]]}],[0,{"type":[0,"mdxJsxFlowElement"],"name":[0,"CodeBlockHTML"],"attributes":[1,[]],"children":[1,[]],"data":[0,{"props":[0,{"json":[0,{"tabs":[1,[[0,{"lang":[0,"graphql"],"disableCopy":[0,false],"showLineNumbers":[0,true],"code":[0,"query Book($id: ID!) {\n book(id: $id) {\n id\n title\n abstract\n }\n}"],"hast":[0,{"type":[0,"root"],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"pre"],"properties":[0,{"class":[1,[[0,"shiki"],[0,"shiki-themes"],[0,"github-light-default"],[0,"houston"],[0,"p-4"],[0,"rounded-b-md"],[0,"max-w-96"]]],"style":[0,"background-color:#F2F4F4;--shiki-dark-bg:#0D171C;color:#546461;--shiki-dark:#B4C0BE; font-variant-ligatures: none;"],"tabindex":[0,"0"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"code"],"properties":[0,{}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"1"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#5C95B2"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"query"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7B00C7;--shiki-dark:#00FAB3"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," Book"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"("]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#B03900;font-style:inherit;--shiki-dark:#7DC0FF;--shiki-dark-font-style:italic"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"$id"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,": "]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#365E72;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"ID"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"!"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,") {"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"2"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#B03900;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," book"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"("]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#B03900;font-style:inherit;--shiki-dark:#7DC0FF;--shiki-dark-font-style:italic"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"id"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,": "]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#B03900;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"$id"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,") {"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"3"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#B03900;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," id"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"4"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#B03900;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," title"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"5"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#B03900;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," abstract"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"6"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," }"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"7"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"}"]}]]]}]]]}]]]}]]]}]]]}]}]]]}]}],"majorComponent":[0,true],"divWrap":[0,true]}]}],[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"In a case like this, "]}],[0,{"type":[0,"emphasis"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"we"]}]]]}],[0,{"type":[0,"text"],"value":[0," know that the second "]}],[0,{"type":[0,"text"],"value":[0,"query's"]}],[0,{"type":[0,"text"],"value":[0," data might already be in the cache, but because that data was fetched by a different "]}],[0,{"type":[0,"text"],"value":[0,"query,"]}],[0,{"type":[0,"text"],"value":[0," "]}],[0,{"type":[0,"emphasis"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"Apollo Client"]}]]]}],[0,{"type":[0,"text"],"value":[0," doesn't know that. To tell "]}],[0,{"type":[0,"text"],"value":[0,"Apollo Client"]}],[0,{"type":[0,"text"],"value":[0," where to look for the cached "]}],[0,{"type":[0,"inlineCode"],"value":[0,"Book"]}],[0,{"type":[0,"text"],"value":[0," object, we can define a "]}],[0,{"type":[0,"text"],"value":[0,"field"]}],[0,{"type":[0,"text"],"value":[0," policy "]}],[0,{"type":[0,"inlineCode"],"value":[0,"read"]}],[0,{"type":[0,"text"],"value":[0," function for the "]}],[0,{"type":[0,"inlineCode"],"value":[0,"book"]}],[0,{"type":[0,"text"],"value":[0," "]}],[0,{"type":[0,"text"],"value":[0,"field:"]}]]]}],[0,{"type":[0,"mdxJsxFlowElement"],"name":[0,"CodeBlockHTML"],"attributes":[1,[]],"children":[1,[]],"data":[0,{"props":[0,{"json":[0,{"tabs":[1,[[0,{"lang":[0,"js"],"disableCopy":[0,false],"showLineNumbers":[0,true],"code":[0,"import { ApolloClient, InMemoryCache } from '@apollo/client';\n\nconst client = new ApolloClient({\n cache: new InMemoryCache({\n typePolicies: {\n Query: {\n fields: {\n book: {\n read(_, { args, toReference }) {\n return toReference({\n __typename: 'Book',\n id: args.id,\n });\n }\n }\n }\n }\n }\n })\n});"],"hast":[0,{"type":[0,"root"],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"pre"],"properties":[0,{"class":[1,[[0,"shiki"],[0,"shiki-themes"],[0,"github-light-default"],[0,"houston"],[0,"p-4"],[0,"rounded-b-md"],[0,"max-w-96"]]],"style":[0,"background-color:#F2F4F4;--shiki-dark-bg:#0D171C;color:#546461;--shiki-dark:#B4C0BE; font-variant-ligatures: none;"],"tabindex":[0,"0"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"code"],"properties":[0,{}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"1"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#5C95B2"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"import"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," { "]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"ApolloClient"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,", "]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"InMemoryCache"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," } "]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#5C95B2"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"from"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7D6800;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," '@apollo/client'"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,";"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"2"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"3"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#5C95B2"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"const"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#365E72;--shiki-dark:#ACAFFF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," client"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," ="]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#5C95B2"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," new"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7B00C7;--shiki-dark:#00FAB3"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," ApolloClient"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"({"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"4"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," cache"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,": "]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#5C95B2"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"new"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7B00C7;--shiki-dark:#00FAB3"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," InMemoryCache"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"({"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"5"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," typePolicies"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,": {"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"6"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," Query"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,": {"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"7"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," fields"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,": {"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"8"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," book"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,": {"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[1,[[0,"line"],[0,"bg-gray-100"],[0,"dark:bg-navy-450"]]]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"9"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7B00C7;--shiki-dark:#00FAB3"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," read"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"("]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#B03900;font-style:inherit;--shiki-dark:#7DC0FF;--shiki-dark-font-style:italic"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"_"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,", { "]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#B03900;font-style:inherit;--shiki-dark:#7DC0FF;--shiki-dark-font-style:italic"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"args"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,", "]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#B03900;font-style:inherit;--shiki-dark:#7DC0FF;--shiki-dark-font-style:italic"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"toReference"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," }) {"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[1,[[0,"line"],[0,"bg-gray-100"],[0,"dark:bg-navy-450"]]]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"10"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#5C95B2"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," return"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7B00C7;--shiki-dark:#00FAB3"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," toReference"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"({"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[1,[[0,"line"],[0,"bg-gray-100"],[0,"dark:bg-navy-450"]]]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"11"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," __typename"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,": "]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7D6800;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"'Book'"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,","]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[1,[[0,"line"],[0,"bg-gray-100"],[0,"dark:bg-navy-450"]]]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"12"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," id"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,": "]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"args"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"."]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"id"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,","]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[1,[[0,"line"],[0,"bg-gray-100"],[0,"dark:bg-navy-450"]]]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"13"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," });"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[1,[[0,"line"],[0,"bg-gray-100"],[0,"dark:bg-navy-450"]]]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"14"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," }"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"15"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," }"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"16"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," }"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"17"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," }"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"18"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," }"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"19"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," })"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"20"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"});"]}]]]}]]]}]]]}]]]}]]]}]}]]]}]}],"majorComponent":[0,true],"divWrap":[0,true]}]}],[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"This "]}],[0,{"type":[0,"inlineCode"],"value":[0,"read"]}],[0,{"type":[0,"text"],"value":[0," function uses the "]}],[0,{"type":[0,"inlineCode"],"value":[0,"toReference"]}],[0,{"type":[0,"text"],"value":[0," helper utility to generate and return a "]}],[0,{"type":[0,"strong"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"cache reference"]}]]]}],[0,{"type":[0,"text"],"value":[0," for a "]}],[0,{"type":[0,"inlineCode"],"value":[0,"Book"]}],[0,{"type":[0,"text"],"value":[0," object, based on its "]}],[0,{"type":[0,"inlineCode"],"value":[0,"__typename"]}],[0,{"type":[0,"text"],"value":[0," and "]}],[0,{"type":[0,"inlineCode"],"value":[0,"id"]}],[0,{"type":[0,"text"],"value":[0,"."]}]]]}],[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"Now whenever a "]}],[0,{"type":[0,"text"],"value":[0,"query"]}],[0,{"type":[0,"text"],"value":[0," includes the "]}],[0,{"type":[0,"inlineCode"],"value":[0,"book"]}],[0,{"type":[0,"text"],"value":[0," "]}],[0,{"type":[0,"text"],"value":[0,"field,"]}],[0,{"type":[0,"text"],"value":[0," the "]}],[0,{"type":[0,"inlineCode"],"value":[0,"read"]}],[0,{"type":[0,"text"],"value":[0," function above executes and returns a reference to a "]}],[0,{"type":[0,"inlineCode"],"value":[0,"Book"]}],[0,{"type":[0,"text"],"value":[0," object. "]}],[0,{"type":[0,"text"],"value":[0,"Apollo Client"]}],[0,{"type":[0,"text"],"value":[0," uses this reference to look up the object in its cache and return it if it's present. If it "]}],[0,{"type":[0,"emphasis"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"isn't"]}]]]}],[0,{"type":[0,"text"],"value":[0," present, "]}],[0,{"type":[0,"text"],"value":[0,"Apollo Client"]}],[0,{"type":[0,"text"],"value":[0," knows it needs to execute the "]}],[0,{"type":[0,"text"],"value":[0,"query"]}],[0,{"type":[0,"text"],"value":[0," over the network."]}]]]}],[0,{"type":[0,"mdxJsxFlowElement"],"name":[0,"Note"],"attributes":[1,[]],"children":[1,[[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"To avoid a network request, "]}],[0,{"type":[0,"emphasis"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"all"]}]]]}],[0,{"type":[0,"text"],"value":[0," of a "]}],[0,{"type":[0,"text"],"value":[0,"query's"]}],[0,{"type":[0,"text"],"value":[0," requested "]}],[0,{"type":[0,"text"],"value":[0,"fields"]}],[0,{"type":[0,"text"],"value":[0," must already be present in the cache. If the detail view's "]}],[0,{"type":[0,"text"],"value":[0,"query"]}],[0,{"type":[0,"text"],"value":[0," fetches "]}],[0,{"type":[0,"emphasis"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"any"]}]]]}],[0,{"type":[0,"text"],"value":[0," "]}],[0,{"type":[0,"inlineCode"],"value":[0,"Book"]}],[0,{"type":[0,"text"],"value":[0," "]}],[0,{"type":[0,"text"],"value":[0,"field"]}],[0,{"type":[0,"text"],"value":[0," that the list view's "]}],[0,{"type":[0,"text"],"value":[0,"query"]}],[0,{"type":[0,"text"],"value":[0," "]}],[0,{"type":[0,"emphasis"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"didn't"]}]]]}],[0,{"type":[0,"text"],"value":[0,", "]}],[0,{"type":[0,"text"],"value":[0,"Apollo Client"]}],[0,{"type":[0,"text"],"value":[0," considers the cache hit to be incomplete, and it executes the full "]}],[0,{"type":[0,"text"],"value":[0,"query"]}],[0,{"type":[0,"text"],"value":[0," over the network."]}]]],"data":[0,{"passthroughRender":[0,true]}]}]]],"data":[0,{"props":[0,{}],"majorComponent":[0,false],"divWrap":[0,true]}]}],[0,{"type":[0,"heading"],"depth":[0,2],"children":[1,[[0,{"type":[0,"text"],"value":[0,"Pagination utilities"]}]]],"data":[0,{"collapseMargin":[0,false]}]}],[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"Pagination is a best practice in "]}],[0,{"type":[0,"text"],"value":[0,"GraphQL"]}],[0,{"type":[0,"text"],"value":[0," "]}],[0,{"type":[0,"link"],"title":[0,null],"url":[0,"https://www.apollographql.com/docs/react/pagination/overview"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"for several reasons"]}]]]}],[0,{"type":[0,"text"],"value":[0,". "]}],[0,{"type":[0,"text"],"value":[0,"Apollo Client"]}],[0,{"type":[0,"text"],"value":[0," enables fetching and caching paginated results using the "]}],[0,{"type":[0,"link"],"title":[0,null],"url":[0,"https://www.apollographql.com/docs/react/pagination/core-api"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"Core pagination API"]}]]]}],[0,{"type":[0,"text"],"value":[0,". The API includes a few important utilities, including the "]}],[0,{"type":[0,"link"],"title":[0,null],"url":[0,"https://www.apollographql.com/docs/react/pagination/core-api/#the-fetchmore-function"],"children":[1,[[0,{"type":[0,"inlineCode"],"value":[0,"fetchMore"]}]]]}],[0,{"type":[0,"text"],"value":[0," function and the "]}],[0,{"type":[0,"inlineCode"],"value":[0,"@connection"]}],[0,{"type":[0,"text"],"value":[0," "]}],[0,{"type":[0,"term"],"text":[0,"directive."],"term":[0,{"name":[0,"directive"],"definition":[0,"A GraphQL annotation for a schema or operation that customizes request execution. Prefixed with `@` and may include arguments. For example, the `@lowerCase` directive below can define logic to return the `username` field in lowercase:\n\n```graphql\ntype User {\n username: String! @lowerCase\n}\n```"],"frontmatter":[0,{"labels":[1,[[0,"GraphQL"]]],"internalOnly":[0,false],"learnMore":[0,"https://www.apollographql.com/docs/apollo-server/schema/directives/"],"learnMoreText":[0,"Learn more about directives"]}]}],"children":[1,[[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"A GraphQL annotation for a schema or operation that customizes request execution. Prefixed with "]}],[0,{"type":[0,"inlineCode"],"value":[0,"@"]}],[0,{"type":[0,"text"],"value":[0," and may include arguments. For example, the "]}],[0,{"type":[0,"inlineCode"],"value":[0,"@lowerCase"]}],[0,{"type":[0,"text"],"value":[0," directive below can define logic to return the "]}],[0,{"type":[0,"inlineCode"],"value":[0,"username"]}],[0,{"type":[0,"text"],"value":[0," field in lowercase:"]}]]]}],[0,{"type":[0,"mdxJsxFlowElement"],"name":[0,"CodeBlockHTML"],"attributes":[1,[]],"children":[1,[]],"data":[0,{"props":[0,{"json":[0,{"tabs":[1,[[0,{"lang":[0,"graphql"],"disableCopy":[0,false],"showLineNumbers":[0,true],"code":[0,"type User {\n username: String! @lowerCase\n}"],"hast":[0,{"type":[0,"root"],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"pre"],"properties":[0,{"class":[1,[[0,"shiki"],[0,"shiki-themes"],[0,"github-light-default"],[0,"houston"],[0,"p-4"],[0,"rounded-b-md"],[0,"max-w-96"]]],"style":[0,"background-color:#F2F4F4;--shiki-dark-bg:#0D171C;color:#546461;--shiki-dark:#B4C0BE; font-variant-ligatures: none;"],"tabindex":[0,"0"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"code"],"properties":[0,{}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"1"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#5C95B2"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"type"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#365E72;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," User"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," {"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"2"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#B03900;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," username"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,": "]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#365E72;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"String"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"!"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7B00C7;--shiki-dark:#00FAB3"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," @lowerCase"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"3"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"}"]}]]]}]]]}]]]}]]]}]]]}]}]]]}]}],"majorComponent":[0,true],"divWrap":[0,true]}]}],[0,{"type":[0,"link"],"url":[0,"https://www.apollographql.com/docs/apollo-server/schema/directives/"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"Learn more about directives."]}]]]}]]]}]]]}],[0,{"type":[0,"heading"],"depth":[0,3],"children":[1,[[0,{"type":[0,"text"],"value":[0,"Incremental loading: "]}],[0,{"type":[0,"inlineCode"],"value":[0,"fetchMore"]}]]],"data":[0,{"collapseMargin":[0,false]}]}],[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"You can use the "]}],[0,{"type":[0,"inlineCode"],"value":[0,"fetchMore"]}],[0,{"type":[0,"text"],"value":[0," function to update a "]}],[0,{"type":[0,"text"],"value":[0,"query's"]}],[0,{"type":[0,"text"],"value":[0," cached result with data returned by a "]}],[0,{"type":[0,"emphasis"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"follow-up"]}]]]}],[0,{"type":[0,"text"],"value":[0," "]}],[0,{"type":[0,"text"],"value":[0,"query."]}],[0,{"type":[0,"text"],"value":[0," Most often, "]}],[0,{"type":[0,"inlineCode"],"value":[0,"fetchMore"]}],[0,{"type":[0,"text"],"value":[0," is used to handle infinite-scroll pagination and other situations where you're loading more data when you already have some."]}]]]}],[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"For details, see "]}],[0,{"type":[0,"link"],"title":[0,null],"url":[0,"https://www.apollographql.com/docs/react/pagination/core-api/#the-fetchmore-function"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"The "]}],[0,{"type":[0,"inlineCode"],"value":[0,"fetchMore"]}],[0,{"type":[0,"text"],"value":[0," function"]}]]]}],[0,{"type":[0,"text"],"value":[0,"."]}]]]}],[0,{"type":[0,"heading"],"depth":[0,3],"children":[1,[[0,{"type":[0,"text"],"value":[0,"The "]}],[0,{"type":[0,"inlineCode"],"value":[0,"@connection"]}],[0,{"type":[0,"text"],"value":[0," directive"]}]]],"data":[0,{"collapseMargin":[0,false]}]}],[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"The "]}],[0,{"type":[0,"inlineCode"],"value":[0,"@connection"]}],[0,{"type":[0,"text"],"value":[0," "]}],[0,{"type":[0,"text"],"value":[0,"directive"]}],[0,{"type":[0,"text"],"value":[0," solves the problem of multiple copies of the same "]}],[0,{"type":[0,"text"],"value":[0,"field"]}],[0,{"type":[0,"text"],"value":[0," in the cache. This can happen with paginated queries because the "]}],[0,{"type":[0,"inlineCode"],"value":[0,"fetchMore"]}],[0,{"type":[0,"text"],"value":[0," function sends follow-up queries to fetch additional pages of results using "]}],[0,{"type":[0,"text"],"value":[0,"arguments"]}],[0,{"type":[0,"text"],"value":[0," like "]}],[0,{"type":[0,"link"],"title":[0,null],"url":[0,"https://www.apollographql.com/docs/react/pagination/offset-based/"],"children":[1,[[0,{"type":[0,"inlineCode"],"value":[0,"offset"]}]]]}],[0,{"type":[0,"text"],"value":[0," and "]}],[0,{"type":[0,"link"],"title":[0,null],"url":[0,"https://www.apollographql.com/docs/react/pagination/offset-based/"],"children":[1,[[0,{"type":[0,"inlineCode"],"value":[0,"limit"]}]]]}],[0,{"type":[0,"text"],"value":[0,". These "]}],[0,{"type":[0,"text"],"value":[0,"arguments"]}],[0,{"type":[0,"text"],"value":[0," inadvertently "]}],[0,{"type":[0,"text"],"value":[0,"fragment"]}],[0,{"type":[0,"text"],"value":[0," data from different pagination requests across the cache."]}]]]}],[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"The "]}],[0,{"type":[0,"inlineCode"],"value":[0,"@connection"]}],[0,{"type":[0,"text"],"value":[0," "]}],[0,{"type":[0,"text"],"value":[0,"directive"]}],[0,{"type":[0,"text"],"value":[0," lets you unify paginated results by specifying a custom, stable cache key for a "]}],[0,{"type":[0,"text"],"value":[0,"field."]}],[0,{"type":[0,"text"],"value":[0," It also lets you "]}],[0,{"type":[0,"emphasis"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"intentionally"]}]]]}],[0,{"type":[0,"text"],"value":[0," separate paginated results in the cache by "]}],[0,{"type":[0,"text"],"value":[0,"fields"]}],[0,{"type":[0,"text"],"value":[0," that you specify."]}]]]}],[0,{"type":[0,"mdxJsxFlowElement"],"name":[0,"Tip"],"attributes":[1,[]],"children":[1,[[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"Starting in "]}],[0,{"type":[0,"text"],"value":[0,"Apollo Client"]}],[0,{"type":[0,"text"],"value":[0," v3, setting the "]}],[0,{"type":[0,"link"],"title":[0,null],"url":[0,"https://www.apollographql.com/docs/react/pagination/key-args/#setting-keyargs"],"children":[1,[[0,{"type":[0,"inlineCode"],"value":[0,"keyArgs"]}],[0,{"type":[0,"text"],"value":[0," field policy"]}]]]}],[0,{"type":[0,"text"],"value":[0," is the most straightforward way to resolve "]}],[0,{"type":[0,"text"],"value":[0,"fragmented"]}],[0,{"type":[0,"text"],"value":[0," pagination results in the cache. For example, setting "]}],[0,{"type":[0,"link"],"title":[0,null],"url":[0,"https://www.apollographql.com/docs/react/pagination/key-args/#supported-values-for-keyargs"],"children":[1,[[0,{"type":[0,"inlineCode"],"value":[0,"keyArgs"]}],[0,{"type":[0,"text"],"value":[0," to "]}],[0,{"type":[0,"inlineCode"],"value":[0,"false"]}]]]}],[0,{"type":[0,"text"],"value":[0," indicates that no "]}],[0,{"type":[0,"text"],"value":[0,"arguments"]}],[0,{"type":[0,"text"],"value":[0," should be included in cache keys, causing all pagination results to be cached together. Additionally, you only have to set your "]}],[0,{"type":[0,"inlineCode"],"value":[0,"keyArgs"]}],[0,{"type":[0,"text"],"value":[0," configuration once, rather than using "]}],[0,{"type":[0,"inlineCode"],"value":[0,"@connection"]}],[0,{"type":[0,"text"],"value":[0," in multiple queries. Refer to the "]}],[0,{"type":[0,"link"],"title":[0,null],"url":[0,"https://www.apollographql.com/docs/react/caching/advanced-topics#connection-directive-usage"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"usage instructions"]}]]]}],[0,{"type":[0,"text"],"value":[0," below to compare "]}],[0,{"type":[0,"inlineCode"],"value":[0,"@connection"]}],[0,{"type":[0,"text"],"value":[0," and "]}],[0,{"type":[0,"inlineCode"],"value":[0,"keyArgs"]}],[0,{"type":[0,"text"],"value":[0," usage."]}]]],"data":[0,{"passthroughRender":[0,true]}]}],[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"The "]}],[0,{"type":[0,"inlineCode"],"value":[0,"@connection"]}],[0,{"type":[0,"text"],"value":[0," "]}],[0,{"type":[0,"text"],"value":[0,"directive"]}],[0,{"type":[0,"text"],"value":[0," is useful when you want to store distinct data in the cache on a "]}],[0,{"type":[0,"text"],"value":[0,"query"]}],[0,{"type":[0,"text"],"value":[0,"-by-"]}],[0,{"type":[0,"text"],"value":[0,"query,"]}],[0,{"type":[0,"text"],"value":[0," "]}],[0,{"type":[0,"text"],"value":[0,"field"]}],[0,{"type":[0,"text"],"value":[0,"-by-"]}],[0,{"type":[0,"text"],"value":[0,"field"]}],[0,{"type":[0,"text"],"value":[0," basis. See the "]}],[0,{"type":[0,"link"],"title":[0,null],"url":[0,"https://www.apollographql.com/docs/react/caching/advanced-topics#advanced-connection-directive-usage"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"advanced usage instructions"]}]]]}],[0,{"type":[0,"text"],"value":[0," for more details."]}]]],"data":[0,{"passthroughRender":[0,true]}]}]]],"data":[0,{"props":[0,{}],"majorComponent":[0,false],"divWrap":[0,true]}]}],[0,{"type":[0,"heading"],"depth":[0,4],"children":[1,[[0,{"type":[0,"inlineCode"],"value":[0,"@connection"]}],[0,{"type":[0,"text"],"value":[0," directive usage"]}]]],"data":[0,{"collapseMargin":[0,false]}]}],[0,{"type":[0,"mdxJsxFlowElement"],"name":[0,"Tip"],"attributes":[1,[]],"children":[1,[[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"For the standard "]}],[0,{"type":[0,"inlineCode"],"value":[0,"@connection"]}],[0,{"type":[0,"text"],"value":[0," "]}],[0,{"type":[0,"text"],"value":[0,"directive"]}],[0,{"type":[0,"text"],"value":[0," usage described in this section, it's best to configure a "]}],[0,{"type":[0,"link"],"title":[0,null],"url":[0,"https://www.apollographql.com/docs/react/pagination/key-args/#setting-keyargs"],"children":[1,[[0,{"type":[0,"inlineCode"],"value":[0,"keyArgs"]}],[0,{"type":[0,"text"],"value":[0," field policy"]}]]]}],[0,{"type":[0,"text"],"value":[0,". For example, you can use the following "]}],[0,{"type":[0,"link"],"title":[0,null],"url":[0,"https://www.apollographql.com/docs/react/pagination/key-args/#setting-keyargs"],"children":[1,[[0,{"type":[0,"inlineCode"],"value":[0,"keyArgs"]}]]]}],[0,{"type":[0,"text"],"value":[0," configuration for the same effect as the "]}],[0,{"type":[0,"inlineCode"],"value":[0,"@connection"]}],[0,{"type":[0,"text"],"value":[0," example below."]}]]],"data":[0,{"passthroughRender":[0,true]}]}],[0,{"type":[0,"mdxJsxFlowElement"],"name":[0,"CodeBlockHTML"],"attributes":[1,[]],"children":[1,[]],"data":[0,{"props":[0,{"json":[0,{"tabs":[1,[[0,{"lang":[0,"js"],"disableCopy":[0,false],"showLineNumbers":[0,true],"code":[0,"const cache = new InMemoryCache({\n typePolicies: {\n Query: {\n fields: {\n feed: {\n keyArgs: [\"type\"]\n }\n }\n }\n }\n})"],"hast":[0,{"type":[0,"root"],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"pre"],"properties":[0,{"class":[1,[[0,"shiki"],[0,"shiki-themes"],[0,"github-light-default"],[0,"houston"],[0,"p-4"],[0,"rounded-b-md"],[0,"max-w-96"]]],"style":[0,"background-color:#F2F4F4;--shiki-dark-bg:#0D171C;color:#546461;--shiki-dark:#B4C0BE; font-variant-ligatures: none;"],"tabindex":[0,"0"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"code"],"properties":[0,{}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"1"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#5C95B2"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"const"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#365E72;--shiki-dark:#ACAFFF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," cache"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," ="]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#5C95B2"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," new"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7B00C7;--shiki-dark:#00FAB3"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," InMemoryCache"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"({"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"2"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," typePolicies"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,": {"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"3"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," Query"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,": {"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"4"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," fields"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,": {"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"5"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," feed"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,": {"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"6"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," keyArgs"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,": ["]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7D6800;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"\"type\""]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"]"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"7"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," }"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"8"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," }"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"9"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," }"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"10"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," }"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"11"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"})"]}]]]}]]]}]]]}]]]}]]]}]}]]]}]}],"majorComponent":[0,true],"divWrap":[0,true]}]}],[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"With this centralized "]}],[0,{"type":[0,"inlineCode"],"value":[0,"keyArg"]}],[0,{"type":[0,"text"],"value":[0,"s configuration, you don't need to include the "]}],[0,{"type":[0,"inlineCode"],"value":[0,"@connection"]}],[0,{"type":[0,"text"],"value":[0," "]}],[0,{"type":[0,"text"],"value":[0,"directive"]}],[0,{"type":[0,"text"],"value":[0," in your queries because the "]}],[0,{"type":[0,"inlineCode"],"value":[0,"type"]}],[0,{"type":[0,"text"],"value":[0," "]}],[0,{"type":[0,"text"],"value":[0,"argument"]}],[0,{"type":[0,"text"],"value":[0," is adequate for keeping feeds of different types separate in the cache. For an example of storing distinct data on a "]}],[0,{"type":[0,"text"],"value":[0,"query"]}],[0,{"type":[0,"text"],"value":[0,"-by-"]}],[0,{"type":[0,"text"],"value":[0,"query"]}],[0,{"type":[0,"text"],"value":[0," basis, see the "]}],[0,{"type":[0,"link"],"title":[0,null],"url":[0,"https://www.apollographql.com/docs/react/caching/advanced-topics#advanced-connection-directive-usage"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"advanced usage instructions"]}]]]}],[0,{"type":[0,"text"],"value":[0,"."]}]]],"data":[0,{"passthroughRender":[0,true]}]}]]],"data":[0,{"props":[0,{}],"majorComponent":[0,false],"divWrap":[0,true]}]}],[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"To use the "]}],[0,{"type":[0,"inlineCode"],"value":[0,"@connection"]}],[0,{"type":[0,"text"],"value":[0," "]}],[0,{"type":[0,"text"],"value":[0,"directive,"]}],[0,{"type":[0,"text"],"value":[0," add it to the "]}],[0,{"type":[0,"text"],"value":[0,"field"]}],[0,{"type":[0,"text"],"value":[0," you want a custom cache key for. The "]}],[0,{"type":[0,"text"],"value":[0,"directive"]}],[0,{"type":[0,"text"],"value":[0," requires a "]}],[0,{"type":[0,"inlineCode"],"value":[0,"key"]}],[0,{"type":[0,"text"],"value":[0," parameter to specify the custom cache key. You can optionally include the "]}],[0,{"type":[0,"inlineCode"],"value":[0,"filter"]}],[0,{"type":[0,"text"],"value":[0," parameter, which takes an array of "]}],[0,{"type":[0,"text"],"value":[0,"query"]}],[0,{"type":[0,"text"],"value":[0," "]}],[0,{"type":[0,"text"],"value":[0,"argument"]}],[0,{"type":[0,"text"],"value":[0," names to include in the generated custom cache key."]}]]]}],[0,{"type":[0,"mdxJsxFlowElement"],"name":[0,"CodeBlockHTML"],"attributes":[1,[]],"children":[1,[]],"data":[0,{"props":[0,{"json":[0,{"tabs":[1,[[0,{"lang":[0,"js"],"disableCopy":[0,false],"showLineNumbers":[0,true],"code":[0,"const query = gql`\n query Feed($type: FeedType!, $offset: Int, $limit: Int) {\n feed(type: $type, offset: $offset, limit: $limit) @connection(key: \"feed\", filter: [\"type\"]) {\n ...FeedEntry\n }\n }\n`"],"hast":[0,{"type":[0,"root"],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"pre"],"properties":[0,{"class":[1,[[0,"shiki"],[0,"shiki-themes"],[0,"github-light-default"],[0,"houston"],[0,"p-4"],[0,"rounded-b-md"],[0,"max-w-96"]]],"style":[0,"background-color:#F2F4F4;--shiki-dark-bg:#0D171C;color:#546461;--shiki-dark:#B4C0BE; font-variant-ligatures: none;"],"tabindex":[0,"0"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"code"],"properties":[0,{}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"1"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#5C95B2"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"const"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#365E72;--shiki-dark:#ACAFFF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," query"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#005AAF;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," ="]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7B00C7;--shiki-dark:#00FAB3"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," gql"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7D6800;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"`"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"2"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7D6800;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," query Feed($type: FeedType!, $offset: Int, $limit: Int) {"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"3"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7D6800;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," feed(type: $type, offset: $offset, limit: $limit) @connection(key: \"feed\", filter: [\"type\"]) {"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"4"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7D6800;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," ...FeedEntry"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"5"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7D6800;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," }"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"6"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7D6800;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," }"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"7"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7D6800;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"`"]}]]]}]]]}]]]}]]]}]]]}]}]]]}]}],"majorComponent":[0,true],"divWrap":[0,true]}]}],[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"With the above "]}],[0,{"type":[0,"text"],"value":[0,"query,"]}],[0,{"type":[0,"text"],"value":[0," even when multiple "]}],[0,{"type":[0,"inlineCode"],"value":[0,"fetchMore"]}],[0,{"type":[0,"text"],"value":[0,"s queries are performed, each feed update always results in an update to the cache's "]}],[0,{"type":[0,"inlineCode"],"value":[0,"feed"]}],[0,{"type":[0,"text"],"value":[0," key with the latest accumulated values. The example also uses the "]}],[0,{"type":[0,"inlineCode"],"value":[0,"@connection"]}],[0,{"type":[0,"text"],"value":[0," "]}],[0,{"type":[0,"text"],"value":[0,"directive's"]}],[0,{"type":[0,"text"],"value":[0," optional "]}],[0,{"type":[0,"inlineCode"],"value":[0,"filter"]}],[0,{"type":[0,"text"],"value":[0," "]}],[0,{"type":[0,"text"],"value":[0,"argument"]}],[0,{"type":[0,"text"],"value":[0," to include the "]}],[0,{"type":[0,"inlineCode"],"value":[0,"type"]}],[0,{"type":[0,"text"],"value":[0," "]}],[0,{"type":[0,"text"],"value":[0,"query"]}],[0,{"type":[0,"text"],"value":[0," "]}],[0,{"type":[0,"text"],"value":[0,"argument"]}],[0,{"type":[0,"text"],"value":[0," in the cache key. This creates multiple cache values that accumulate queries from each type of feed."]}]]]}],[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"With a stable cache key, you can use "]}],[0,{"type":[0,"link"],"title":[0,null],"url":[0,"https://www.apollographql.com/docs/react/caching/cache-interaction/#writequery"],"children":[1,[[0,{"type":[0,"inlineCode"],"value":[0,"writeQuery"]}]]]}],[0,{"type":[0,"text"],"value":[0," to perform a cache update that clears out the feed."]}]]]}],[0,{"type":[0,"mdxJsxFlowElement"],"name":[0,"CodeBlockHTML"],"attributes":[1,[]],"children":[1,[]],"data":[0,{"props":[0,{"json":[0,{"tabs":[1,[[0,{"lang":[0,"js"],"disableCopy":[0,false],"showLineNumbers":[0,true],"code":[0,"client.writeQuery({\n query: gql`\n query Feed($type: FeedType!) {\n feed(type: $type) @connection(key: \"feed\", filter: [\"type\"]) {\n id\n }\n }\n `,\n variables: {\n type: \"top\",\n },\n data: {\n feed: [],\n },\n});"],"hast":[0,{"type":[0,"root"],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"pre"],"properties":[0,{"class":[1,[[0,"shiki"],[0,"shiki-themes"],[0,"github-light-default"],[0,"houston"],[0,"p-4"],[0,"rounded-b-md"],[0,"max-w-96"]]],"style":[0,"background-color:#F2F4F4;--shiki-dark-bg:#0D171C;color:#546461;--shiki-dark:#B4C0BE; font-variant-ligatures: none;"],"tabindex":[0,"0"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"code"],"properties":[0,{}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"1"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"client"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"."]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7B00C7;--shiki-dark:#00FAB3"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"writeQuery"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"({"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"2"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," query"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,": "]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7B00C7;--shiki-dark:#00FAB3"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"gql"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7D6800;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"`"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"3"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7D6800;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," query Feed($type: FeedType!) {"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"4"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7D6800;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," feed(type: $type) @connection(key: \"feed\", filter: [\"type\"]) {"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"5"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7D6800;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," id"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"6"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7D6800;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," }"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"7"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7D6800;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," }"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"8"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7D6800;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," `"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,","]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"9"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," variables"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,": {"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"10"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," type"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,": "]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#7D6800;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"\"top\""]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,","]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"11"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," },"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"12"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," data"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,": {"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"13"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#7DC0FF"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," feed"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,": [],"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"14"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0," },"]}]]]}]]]}],[0,{"type":[0,"text"],"value":[0,"\n"]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"class":[0,"line"]}],"children":[1,[[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"className":[1,[[0,"select-none inline-block text-right w-8 mr-4"]]]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"15"]}]]]}],[0,{"type":[0,"element"],"tagName":[0,"span"],"properties":[0,{"style":[0,"color:#546461;--shiki-dark:#B4C0BE"]}],"children":[1,[[0,{"type":[0,"text"],"value":[0,"});"]}]]]}]]]}]]]}]]]}]]]}]}]]]}]}],"majorComponent":[0,true],"divWrap":[0,true]}]}],[0,{"type":[0,"mdxJsxFlowElement"],"name":[0,"Note"],"attributes":[1,[]],"children":[1,[[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"Because this example uses the "]}],[0,{"type":[0,"inlineCode"],"value":[0,"type"]}],[0,{"type":[0,"text"],"value":[0," "]}],[0,{"type":[0,"text"],"value":[0,"argument"]}],[0,{"type":[0,"text"],"value":[0," in the cache key, it doesn't need to provide "]}],[0,{"type":[0,"inlineCode"],"value":[0,"offset"]}],[0,{"type":[0,"text"],"value":[0," or "]}],[0,{"type":[0,"inlineCode"],"value":[0,"limit"]}],[0,{"type":[0,"text"],"value":[0," "]}],[0,{"type":[0,"text"],"value":[0,"arguments."]}]]],"data":[0,{"passthroughRender":[0,true]}]}]]],"data":[0,{"props":[0,{}],"majorComponent":[0,false],"divWrap":[0,true]}]}],[0,{"type":[0,"heading"],"depth":[0,4],"children":[1,[[0,{"type":[0,"text"],"value":[0,"Advanced "]}],[0,{"type":[0,"inlineCode"],"value":[0,"@connection"]}],[0,{"type":[0,"text"],"value":[0," directive usage"]}]]],"data":[0,{"collapseMargin":[0,false]}]}],[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"The "]}],[0,{"type":[0,"inlineCode"],"value":[0,"@connection"]}],[0,{"type":[0,"text"],"value":[0," "]}],[0,{"type":[0,"text"],"value":[0,"directive"]}],[0,{"type":[0,"text"],"value":[0," is useful when using the same "]}],[0,{"type":[0,"text"],"value":[0,"field"]}],[0,{"type":[0,"text"],"value":[0," in multiple queries, with no distinguishing "]}],[0,{"type":[0,"text"],"value":[0,"arguments"]}],[0,{"type":[0,"text"],"value":[0," (for example, "]}],[0,{"type":[0,"inlineCode"],"value":[0,"type"]}],[0,{"type":[0,"text"],"value":[0,") that "]}],[0,{"type":[0,"inlineCode"],"value":[0,"keyArgs"]}],[0,{"type":[0,"text"],"value":[0," can use, and you want to keep that "]}],[0,{"type":[0,"text"],"value":[0,"field's"]}],[0,{"type":[0,"text"],"value":[0," data separate in the cache."]}]]]}],[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"For example, Apollo's "]}],[0,{"type":[0,"link"],"title":[0,null],"url":[0,"https://github.com/apollographql/spotify-showcase"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"Spotify showcase"]}]]]}],[0,{"type":[0,"text"],"value":[0," uses "]}],[0,{"type":[0,"inlineCode"],"value":[0,"@connection"]}],[0,{"type":[0,"text"],"value":[0," to independently cache lists of playlists. One list is in the left sidebar, where you navigate between playlists. The other appears when you right-click a song to add it to a playlist."]}]]]}],[0,{"type":[0,"mdxJsxFlowElement"],"name":[0,"img"],"attributes":[1,[]],"children":[1,[]],"data":[0,{"props":[0,{"src":[0,"/docs/_image/react/caching/advanced-topics/233a98664200?w=1200"],"class":[0,"screenshot"],"alt":[0,"Separately cached playlists in Apollo's Spotify Showcase"]}]}]}],[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"Without caching the playlists separately, loading the next page of data from one list affects the other, negatively impacting the UX."]}]]]}],[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"For code examples, see:"]}]]]}],[0,{"type":[0,"list"],"ordered":[0,false],"start":[0,null],"spread":[0,false],"children":[1,[[0,{"type":[0,"listItem"],"spread":[0,false],"checked":[0,null],"children":[1,[[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"link"],"title":[0,null],"url":[0,"https://github.com/apollographql/spotify-showcase/blob/185f7b8a155209e9a099490dbc5d1e3bfba4c32f/client/src/apollo/client.ts#L105-L108"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"The type policy"]}]]]}]]]}]]]}],[0,{"type":[0,"listItem"],"spread":[0,false],"checked":[0,null],"children":[1,[[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"link"],"title":[0,null],"url":[0,"https://github.com/apollographql/spotify-showcase/blob/185f7b8a155209e9a099490dbc5d1e3bfba4c32f/client/src/components/LoggedInLayout.tsx#L75"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"Playlist sidebar query"]}]]]}]]]}]]]}],[0,{"type":[0,"listItem"],"spread":[0,false],"checked":[0,null],"children":[1,[[0,{"type":[0,"paragraph"],"children":[1,[[0,{"type":[0,"link"],"title":[0,null],"url":[0,"https://github.com/apollographql/spotify-showcase/blob/185f7b8a155209e9a099490dbc5d1e3bfba4c32f/client/src/components/ContextMenuAction/AddToPlaylist.tsx#L17"],"children":[1,[[0,{"type":[0,"text"],"value":[0,"Add to playlist menu"]}]]]}]]]}]]]}]]]}]]]}]}" ssr="" client="load" opts="{"name":"MDXRenderRoot","value":true}" await-children="">
This article describes special cases and considerations when using the Apollo Client cache.
Sometimes you shouldn't use the cache for a particular GraphQL operation. For example, a query's response might be a token that's only used once. In cases like this, use the no-cache
fetch policy:
1const { loading, error, data } = useQuery(GET_DOGS, {
2 fetchPolicy: "no-cache"
3});
Operations that use this fetch policy don't write their result to the cache, and they also don't check the cache for data before sending a request to your server. See all available fetch policies.
You can persist and rehydrate the InMemoryCache
from a storage provider like AsyncStorage
or localStorage
. To do so, use the apollo3-cache-persist
library. This library works with a variety of storage providers.
To get started, pass your cache and a storage provider to persistCache
. By default, the contents of your cache are immediately restored asynchronously, and they're persisted on every write to the cache with a short configurable debounce interval.
persistCache
method is async and returns a Promise
.1import AsyncStorage from '@react-native-async-storage/async-storage';
2import { InMemoryCache } from '@apollo/client';
3import { persistCache } from 'apollo3-cache-persist';
4
5const cache = new InMemoryCache();
6
7persistCache({
8 cache,
9 storage: AsyncStorage,
10}).then(() => {
11 // Continue setting up Apollo Client as usual.
12})
For advanced usage and additional configuration options, see the README of apollo3-cache-persist
.
Sometimes, you might want to reset the cache entirely, such as when a user logs out. To accomplish this, call client.resetStore
. This method is asynchronous, because it also refetches any of your active queries.
1import { useQuery } from '@apollo/client';
2function Profile() {
3 const { data, client } = useQuery(PROFILE_QUERY);
4 return (
5 <Fragment>
6 <p>Current user: {data?.currentUser}</p>
7 <button onClick={async ()=>client.resetStore()}>
8 Log out
9 </button>
10 </Fragment>
11 );
12}
To reset the cache without refetching active queries, use client.clearStore()
instead of client.resetStore()
.
You can register callback functions that execute whenever client.resetStore
is called. To do so, call client.onResetStore
and pass in your callback. To register multiple callbacks, call client.onResetStore
multiple times. All of your callbacks are added to an array and are executed concurrently whenever the cache is reset.
In this example, we use client.onResetStore
to write default values to the cache. This is useful when using Apollo Client's local state management features and calling client.resetStore
anywhere in your application.
1import { ApolloClient, InMemoryCache } from '@apollo/client';
2import { withClientState } from 'apollo-link-state';
3
4import { resolvers, defaults } from './resolvers';
5
6const cache = new InMemoryCache();
7const stateLink = withClientState({ cache, resolvers, defaults });
8
9const client = new ApolloClient({
10 cache,
11 link: stateLink,
12});
13
14client.onResetStore(stateLink.writeDefaults);
You can also call client.onResetStore
from your React components. This can be useful if you want to force your UI to rerender after the cache is reset.
The client.onResetStore
method's return value is a function you can call to unregister your callback:
1import { useApolloClient } from '@apollo/client';
2
3function Foo (){
4 const [reset, setReset] = useState(0);
5 const client = useApolloClient();
6
7 useEffect(() => {
8 const unsubscribe = client.onResetStore(() =>
9 new Promise(()=>setReset(reset + 1))
10 );
11
12 return () => {
13 unsubscribe();
14 };
15 });
16
17 return reset ? <div /> : <span />
18}
19
20export default Foo;
JavaScript developers will be familiar with the idea of inheritancefrom the extends
clause of class
declarations, or possibly from dealing with chains created by Object.create
.
Inheritance is a powerful code-sharing tool, and it works well with Apollo Client for several reasons:
InMemoryCache
already knows about the supertype-subtype relationships (interfaces and unions) in your schema, thanks to possibleTypes
, so no additional configuration is necessary to provide that information.
Inheritance allows a supertype to provide default configuration values to all its subtypes, including keyFields
and individual field policies, which can be selectively overridden by subtypes that want something different.
A single subtype can have multiple supertypes in a GraphQL schema, which is difficult to model using the single inheritance model of classes or s. In other words, supporting multiple inheritance in JavaScript requires building a system something like this one, rather than just reusing built-in language features.
Developers can add their own client-only supertypes to the possibleTypes
map, as a way of reusing behavior across types, even if their schema knows nothing about those supertypes.
The possibleTypes
map is currently used only for fragment matching purposes, which is an important but fairly small part of what the client does. Inheritance adds another compelling use for possibleTypes
, and should drastically reduce repetition of typePolicies
when used effectively.
Here's how type policy inheritance works for InMemoryCache
, considering the example below:
1const cache = new InMemoryCache({
2 possibleTypes: {
3 Reptile: ["Snake", "Turtle"],
4 Snake: ["Python", "Viper", "Cobra"],
5 Viper: ["Cottonmouth", "DeathAdder"],
6 },
7
8 typePolicies: {
9 Reptile: {
10 // Suppose all our reptiles are captive, and have a tag with an ID.
11 keyFields: ["tagId"],
12 fields: {
13 // Scientific name-related logic can be shared among Reptile subtypes.
14 scientificName: {
15 merge(_, incoming) {
16 // Normalize all scientific names to lower case.
17 return incoming.toLowerCase();
18 },
19 },
20 },
21 },
22
23 Snake: {
24 fields: {
25 // Default to a truthy non-boolean value if we don't know
26 // whether this snake is venomous.
27 venomous(status = "unknown") {
28 return status;
29 },
30 },
31 },
32 },
33});
In certain cases, writing an update
function to update the cache after a mutation can be complex, or even impossible if the mutation doesn't return modified fields.
In these cases, you can provide a refetchQueries
option to the useMutation
hook to automatically rerun certain queries after the mutation completes.
For details, see Refetching queries.
refetchQueries
can be faster to implement than an update
function, it also requires additional network requests that are usually undesirable. For more information, see this blog post.In some cases, a query requests data that already exists in the cache under a different reference. For example, your UI might have a list view and a detail view that both use the same data.
The list view might run the following query:
1query Books {
2 books {
3 id
4 title
5 abstract
6 }
7}
When a specific book is selected, the detail view might display an individual item using this query:
1query Book($id: ID!) {
2 book(id: $id) {
3 id
4 title
5 abstract
6 }
7}
In a case like this, we know that the second query's data might already be in the cache, but because that data was fetched by a different query, Apollo Client doesn't know that. To tell Apollo Client where to look for the cached Book
object, we can define a field policy read
function for the book
field:
1import { ApolloClient, InMemoryCache } from '@apollo/client';
2
3const client = new ApolloClient({
4 cache: new InMemoryCache({
5 typePolicies: {
6 Query: {
7 fields: {
8 book: {
9 read(_, { args, toReference }) {
10 return toReference({
11 __typename: 'Book',
12 id: args.id,
13 });
14 }
15 }
16 }
17 }
18 }
19 })
20});
This read
function uses the toReference
helper utility to generate and return a cache reference for a Book
object, based on its __typename
and id
.
Now whenever a query includes the book
field, the read
function above executes and returns a reference to a Book
object. Apollo Client uses this reference to look up the object in its cache and return it if it's present. If it isn't present, Apollo Client knows it needs to execute the query over the network.
Book
field that the list view's query didn't, Apollo Client considers the cache hit to be incomplete, and it executes the full query over the network.Pagination is a best practice in GraphQL for several reasons. Apollo Client enables fetching and caching paginated results using the Core pagination API. The API includes a few important utilities, including the fetchMore
function and the @connection
directive.
fetchMore
You can use the fetchMore
function to update a query's cached result with data returned by a follow-upquery. Most often, fetchMore
is used to handle infinite-scroll pagination and other situations where you're loading more data when you already have some.
For details, see The fetchMore
function.
@connection
directiveThe @connection
directive solves the problem of multiple copies of the same field in the cache. This can happen with paginated queries because the fetchMore
function sends follow-up queries to fetch additional pages of results using arguments like offset
and limit
. These arguments inadvertently fragment data from different pagination requests across the cache.
The @connection
directive lets you unify paginated results by specifying a custom, stable cache key for a field. It also lets you intentionally separate paginated results in the cache by fields that you specify.
keyArgs
field policy is the most straightforward way to resolve fragmented pagination results in the cache. For example, setting keyArgs
to false
indicates that no arguments should be included in cache keys, causing all pagination results to be cached together. Additionally, you only have to set your keyArgs
configuration once, rather than using @connection
in multiple queries. Refer to the usage instructions below to compare @connection
and keyArgs
usage.The @connection
directive is useful when you want to store distinct data in the cache on a query-by-query, field-by-field basis. See the advanced usage instructions for more details.@connection
directive usage@connection
directive usage described in this section, it's best to configure a keyArgs
field policy. For example, you can use the following keyArgs
configuration for the same effect as the @connection
example below.1const cache = new InMemoryCache({
2 typePolicies: {
3 Query: {
4 fields: {
5 feed: {
6 keyArgs: ["type"]
7 }
8 }
9 }
10 }
11})
keyArg
s configuration, you don't need to include the @connection
directive in your queries because the type
argument is adequate for keeping feeds of different types separate in the cache. For an example of storing distinct data on a query-by-query basis, see the advanced usage instructions.To use the @connection
directive, add it to the field you want a custom cache key for. The directive requires a key
parameter to specify the custom cache key. You can optionally include the filter
parameter, which takes an array of query argument names to include in the generated custom cache key.
1const query = gql`
2 query Feed($type: FeedType!, $offset: Int, $limit: Int) {
3 feed(type: $type, offset: $offset, limit: $limit) @connection(key: "feed", filter: ["type"]) {
4 ...FeedEntry
5 }
6 }
7`
With the above query, even when multiple fetchMore
s queries are performed, each feed update always results in an update to the cache's feed
key with the latest accumulated values. The example also uses the @connection
directive's optional filter
argument to include the type
query argument in the cache key. This creates multiple cache values that accumulate queries from each type of feed.
With a stable cache key, you can use writeQuery
to perform a cache update that clears out the feed.
1client.writeQuery({
2 query: gql`
3 query Feed($type: FeedType!) {
4 feed(type: $type) @connection(key: "feed", filter: ["type"]) {
5 id
6 }
7 }
8 `,
9 variables: {
10 type: "top",
11 },
12 data: {
13 feed: [],
14 },
15});
type
argument in the cache key, it doesn't need to provide offset
or limit
arguments.@connection
directive usageThe @connection
directive is useful when using the same field in multiple queries, with no distinguishing arguments (for example, type
) that keyArgs
can use, and you want to keep that field's data separate in the cache.
For example, Apollo's showcaseuses @connection
to independently cache lists of playlists. One list is in the left sidebar, where you navigate between playlists. The other appears when you right-click a song to add it to a playlist.
Without caching the playlists separately, loading the next page of data from one list affects the other, negatively impacting the UX.
For code examples, see: