[{"data":1,"prerenderedAt":362},["ShallowReactive",2],{"navigation_docs":3,"diagnostic-content-NUXT0094":48},[4,8,12,16,20,24,28,32,36,40,44],{"title":5,"path":6,"stem":7},"CLI","\u002Fcli","1.cli",{"title":9,"path":10,"stem":11},"Nuxt","\u002Fnuxt","2.nuxt",{"title":13,"path":14,"stem":15},"Vue","\u002Fvue","3.vue",{"title":17,"path":18,"stem":19},"Vite","\u002Fvite","4.vite",{"title":21,"path":22,"stem":23},"Nitro","\u002Fnitro","5.nitro",{"title":25,"path":26,"stem":27},"TypeScript","\u002Ftypescript","6.typescript",{"title":29,"path":30,"stem":31},"shadcn","\u002Fshadcn","7.shadcn",{"title":33,"path":34,"stem":35},"Package","\u002Fpackage","8.package",{"title":37,"path":38,"stem":39},"Extending Doctor","\u002Fextending","9.extending",{"title":41,"path":42,"stem":43},"MCP","\u002Fmcp","9.mcp",{"title":45,"path":46,"stem":47},"Pinia","\u002Fpinia","9.pinia",{"id":49,"title":50,"body":51,"category":57,"code":351,"description":352,"docsUrl":58,"extension":353,"fix":89,"framework":354,"meta":355,"navigation":356,"pack":60,"path":357,"ruleId":61,"rulePath":62,"seo":358,"severity":63,"source":64,"sourceUrl":65,"stem":359,"why":360,"__hash__":361},"diagnostics\u002Fdiagnostics\u002FNUXT0094.md","NUXT0094: Bound keepalive caches on pages with route params",{"type":52,"value":53,"toc":341},"minimark",[54,66,71,83,87,90,94,99,102,202,205,277,281,284,309,313,325,329,337],[55,56],"rule-metadata",{"category":57,"docsUrl":58,"fix":59,"pack":60,"ruleId":61,"rulePath":62,"severity":63,"source":64,"sourceUrl":65},"performance","https:\u002F\u002Fvuejs.org\u002Fguide\u002Fbuilt-ins\u002Fkeep-alive.html#max-cached-instances","suggestion","vite-doctor\u002Fnuxt","nuxt\u002Frouting\u002Fkeepalive-requires-max","\u002Fnuxt\u002Frules\u002Frouting\u002Fkeepalive-requires-max","warn","src\u002Frule-packs\u002Fnuxt\u002Frules\u002Fnuxt\u002Fkeepalive-requires-max.ts","https:\u002F\u002Fgithub.com\u002Fonmax\u002Fvite-doctor\u002Fblob\u002Fmain\u002Fsrc\u002Frule-packs\u002Fnuxt\u002Frules\u002Fnuxt\u002Fkeepalive-requires-max.ts",[67,68,70],"h2",{"id":69},"why-it-happens","Why it happens",[72,73,74,75,79,80,82],"p",{},"Nuxt keys each page by its route path with the params filled in, unless definePageMeta sets a key. keepalive: true reaches Vue's ",[76,77,78],"code",{},"\u003CKeepAlive>"," as {}, and ",[76,81,78],{}," evicts cached instances only when max is set. So every distinct id a user visits leaves a mounted page instance behind, with its watchers, effects and fetched data, and the cache grows until the tab closes. Doctor reads params from the resolved Nuxt pages when the manifest is current, otherwise from definePageMeta path or the file path, including parent directories. It skips params named locale, lang or language, which take a few configured values, and it skips a page whose definePageMeta key is a static value, a function that never reads the route, or a function Doctor cannot follow. A current manifest also identifies custom pages outside the pages directory. keepalive options with exclude are skipped as well; options with include are reported only when the resolved Nuxt runtime is 4.5 or later, which adds opted-in pages to the include set.",[67,84,86],{"id":85},"fix","Fix",[72,88,89],{},"Set keepalive: { max: N } so Vue drops the least recently used instance, or give the page a key that does not read the params so one instance is reused for every value.",[67,91,93],{"id":92},"example","Example",[95,96,98],"h3",{"id":97},"bound-the-cache-for-a-dynamic-page","Bound the cache for a dynamic page",[72,100,101],{},"Before",[103,104,109],"pre",{"className":105,"code":106,"language":107,"meta":108,"style":108},"language-vue shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","\u003C!-- app\u002Fpages\u002Fproduct\u002F[id].vue -->\n\u003Cscript setup lang=\"ts\">\ndefinePageMeta({\n  keepalive: true,\n})\n\u003C\u002Fscript>\n","vue","",[76,110,111,120,153,167,183,192],{"__ignoreMap":108},[112,113,116],"span",{"class":114,"line":115},"line",1,[112,117,119],{"class":118},"sHwdD","\u003C!-- app\u002Fpages\u002Fproduct\u002F[id].vue -->\n",[112,121,123,127,131,135,138,141,144,148,150],{"class":114,"line":122},2,[112,124,126],{"class":125},"sMK4o","\u003C",[112,128,130],{"class":129},"swJcz","script",[112,132,134],{"class":133},"spNyl"," setup",[112,136,137],{"class":133}," lang",[112,139,140],{"class":125},"=",[112,142,143],{"class":125},"\"",[112,145,147],{"class":146},"sfazB","ts",[112,149,143],{"class":125},[112,151,152],{"class":125},">\n",[112,154,156,160,164],{"class":114,"line":155},3,[112,157,159],{"class":158},"s2Zo4","definePageMeta",[112,161,163],{"class":162},"sTEyZ","(",[112,165,166],{"class":125},"{\n",[112,168,170,173,176,180],{"class":114,"line":169},4,[112,171,172],{"class":129},"  keepalive",[112,174,175],{"class":125},":",[112,177,179],{"class":178},"sfNiH"," true",[112,181,182],{"class":125},",\n",[112,184,186,189],{"class":114,"line":185},5,[112,187,188],{"class":125},"}",[112,190,191],{"class":162},")\n",[112,193,195,198,200],{"class":114,"line":194},6,[112,196,197],{"class":125},"\u003C\u002F",[112,199,130],{"class":129},[112,201,152],{"class":125},[72,203,204],{},"After",[103,206,208],{"className":105,"code":207,"language":107,"meta":108,"style":108},"\u003C!-- app\u002Fpages\u002Fproduct\u002F[id].vue -->\n\u003Cscript setup lang=\"ts\">\ndefinePageMeta({\n  keepalive: { max: 5 },\n})\n\u003C\u002Fscript>\n",[76,209,210,214,234,242,263,269],{"__ignoreMap":108},[112,211,212],{"class":114,"line":115},[112,213,119],{"class":118},[112,215,216,218,220,222,224,226,228,230,232],{"class":114,"line":122},[112,217,126],{"class":125},[112,219,130],{"class":129},[112,221,134],{"class":133},[112,223,137],{"class":133},[112,225,140],{"class":125},[112,227,143],{"class":125},[112,229,147],{"class":146},[112,231,143],{"class":125},[112,233,152],{"class":125},[112,235,236,238,240],{"class":114,"line":155},[112,237,159],{"class":158},[112,239,163],{"class":162},[112,241,166],{"class":125},[112,243,244,246,248,251,254,256,260],{"class":114,"line":169},[112,245,172],{"class":129},[112,247,175],{"class":125},[112,249,250],{"class":125}," {",[112,252,253],{"class":129}," max",[112,255,175],{"class":125},[112,257,259],{"class":258},"sbssI"," 5",[112,261,262],{"class":125}," },\n",[112,264,265,267],{"class":114,"line":185},[112,266,188],{"class":125},[112,268,191],{"class":162},[112,270,271,273,275],{"class":114,"line":194},[112,272,197],{"class":125},[112,274,130],{"class":129},[112,276,152],{"class":125},[67,278,280],{"id":279},"verify-the-fix","Verify the fix",[72,282,283],{},"Run only this rule after editing so the report stays focused on the diagnostic you are closing:",[103,285,289],{"className":286,"code":287,"language":288,"meta":108,"style":108},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","pnpm nuxt doctor --rules nuxt\u002Frouting\u002Fkeepalive-requires-max\n","bash",[76,290,291],{"__ignoreMap":108},[112,292,293,297,300,303,306],{"class":114,"line":115},[112,294,296],{"class":295},"sBMFI","pnpm",[112,298,299],{"class":146}," nuxt",[112,301,302],{"class":146}," doctor",[112,304,305],{"class":146}," --rules",[112,307,308],{"class":146}," nuxt\u002Frouting\u002Fkeepalive-requires-max\n",[67,310,312],{"id":311},"useful-links","Useful links",[314,315,316],"ul",{},[317,318,319],"li",{},[320,321,324],"a",{"href":58,"rel":322},[323],"nofollow","Upstream docs",[67,326,328],{"id":327},"related-rule","Related rule",[314,330,331],{},[317,332,333],{},[320,334,335],{"href":62},[76,336,61],{},[338,339,340],"style",{},"html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sfNiH, html code.shiki .sfNiH{--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}",{"title":108,"searchDepth":122,"depth":122,"links":342},[343,344,345,348,349,350],{"id":69,"depth":122,"text":70},{"id":85,"depth":122,"text":86},{"id":92,"depth":122,"text":93,"children":346},[347],{"id":97,"depth":155,"text":98},{"id":279,"depth":122,"text":280},{"id":311,"depth":122,"text":312},{"id":327,"depth":122,"text":328},"NUXT0094","Finds pages that set definePageMeta({ keepalive }) without max when the route has a dynamic param, such as pages\u002Fproduct\u002F[id].vue, and the page key still includes that param.","md","nuxt",{},true,"\u002Fdiagnostics\u002Fnuxt0094",{"title":50,"description":352},"diagnostics\u002FNUXT0094","Nuxt keys each page by its route path with the params filled in, unless definePageMeta sets a key. keepalive: true reaches Vue's \u003CKeepAlive> as {}, and \u003CKeepAlive> evicts cached instances only when max is set. So every distinct id a user visits leaves a mounted page instance behind, with its watchers, effects and fetched data, and the cache grows until the tab closes. Doctor reads params from the resolved Nuxt pages when the manifest is current, otherwise from definePageMeta path or the file path, including parent directories. It skips params named locale, lang or language, which take a few configured values, and it skips a page whose definePageMeta key is a static value, a function that never reads the route, or a function Doctor cannot follow. A current manifest also identifies custom pages outside the pages directory. keepalive options with exclude are skipped as well; options with include are reported only when the resolved Nuxt runtime is 4.5 or later, which adds opted-in pages to the include set.","e_1QkTjBZ7FzejRhYwOcud8I50qrCgu29Lt1GYHUt48",1795268822417]