[{"data":1,"prerenderedAt":428,"buildId":429},["ShallowReactive",2],{"navigation_docs":3,"rule-content-\u002Fnuxt\u002Frules\u002Fstate\u002Fno-diverging-usestate-init":104},[4,32,36,40,44,48,52,64,68,92,96,100],{"title":5,"path":6,"stem":7,"children":8,"icon":31},"CLI","\u002Fcli","1.cli\u002F1.index",[9,11,15,19,23,27],{"title":10,"path":6,"stem":7},"Run Doctor",{"title":12,"path":13,"stem":14},"Reports","\u002Fcli\u002Freports","1.cli\u002F2.reports",{"title":16,"path":17,"stem":18},"Configuration","\u002Fcli\u002Fconfiguration","1.cli\u002F3.configuration",{"title":20,"path":21,"stem":22},"CI and changed files","\u002Fcli\u002Fci","1.cli\u002F4.ci",{"title":24,"path":25,"stem":26},"Workspaces","\u002Fcli\u002Fworkspaces","1.cli\u002F5.workspaces",{"title":28,"path":29,"stem":30},"Cache and speed","\u002Fcli\u002Fcache","1.cli\u002F6.cache","i-lucide-terminal",{"title":33,"path":34,"stem":35},"Nuxt","\u002Fnuxt","2.nuxt",{"title":37,"path":38,"stem":39},"Vue","\u002Fvue","3.vue",{"title":41,"path":42,"stem":43},"Vite","\u002Fvite","4.vite",{"title":45,"path":46,"stem":47},"Nitro","\u002Fnitro","5.nitro",{"title":49,"path":50,"stem":51},"TypeScript","\u002Ftypescript","6.typescript",{"title":53,"path":54,"stem":55,"children":56,"icon":63},"Design system","\u002Fdesign-system","7.design-system\u002F1.index",[57,59],{"title":58,"path":54,"stem":55},"Overview",{"title":60,"path":61,"stem":62},"Classes and styles","\u002Fdesign-system\u002Fclasses","7.design-system\u002F2.classes","i-lucide-swatch-book",{"title":65,"path":66,"stem":67},"Package","\u002Fpackage","8.package",{"title":69,"path":70,"stem":71,"children":72,"icon":91},"Extending Doctor","\u002Fextending","9.extending\u002F1.index",[73,75,79,83,87],{"title":74,"path":70,"stem":71},"Write an extension",{"title":76,"path":77,"stem":78},"Visitors","\u002Fextending\u002Fvisitors","9.extending\u002F2.visitors",{"title":80,"path":81,"stem":82},"Ship with a library","\u002Fextending\u002Fshipping","9.extending\u002F3.shipping",{"title":84,"path":85,"stem":86},"Test a Rule","\u002Fextending\u002Ftesting","9.extending\u002F4.testing",{"title":88,"path":89,"stem":90},"Rule inputs","\u002Fextending\u002Frule-inputs","9.extending\u002F5.rule-inputs","i-lucide-puzzle",{"title":93,"path":94,"stem":95},"H3","\u002Fh3","9.h3",{"title":97,"path":98,"stem":99},"MCP","\u002Fmodel-context-protocol","9.model-context-protocol",{"title":101,"path":102,"stem":103},"Pinia","\u002Fpinia","9.pinia",{"id":105,"title":106,"body":107,"category":113,"description":415,"diagnosticCodes":416,"docsUrl":115,"extension":417,"fix":116,"framework":418,"meta":419,"navigation":420,"pack":117,"path":422,"recommendedReplacement":423,"ruleId":118,"seo":424,"severity":119,"source":120,"sourceUrl":121,"stem":425,"why":426,"__hash__":427},"rules\u002Fnuxt\u002Frules\u002Fstate\u002Fno-diverging-usestate-init.md","Initialize each useState key in one place",{"type":108,"value":109,"toc":406},"minimark",[110,122,127,159,163,170,174,184,188,214,218,223,226,328,331,402],[111,112],"rule-metadata",{"category":113,"diagnosticCodes":114,"docsUrl":115,"fix":116,"pack":117,"ruleId":118,"severity":119,"source":120,"sourceUrl":121},"state","NUXT0097","https:\u002F\u002Fnuxt.com\u002Fdocs\u002F4.x\u002Fapi\u002Fcomposables\u002Fuse-state#usage","suggestion","vite-doctor\u002Fnuxt","nuxt\u002Fstate\u002Fno-diverging-usestate-init","warn","src\u002Frule-packs\u002Fnuxt\u002Frules\u002Fnuxt\u002Fno-diverging-usestate-init.ts","https:\u002F\u002Fgithub.com\u002Fwords-with-agents\u002Fvite-doctor\u002Fblob\u002Fmain\u002Fsrc\u002Frule-packs\u002Fnuxt\u002Frules\u002Fnuxt\u002Fno-diverging-usestate-init.ts",[123,124,126],"h2",{"id":125},"run-this-rule","Run this rule",[128,129,134],"pre",{"className":130,"code":131,"language":132,"meta":133,"style":133},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","pnpm nuxt doctor --rules nuxt\u002Fstate\u002Fno-diverging-usestate-init\n","bash","",[135,136,137],"code",{"__ignoreMap":133},[138,139,142,146,150,153,156],"span",{"class":140,"line":141},"line",1,[138,143,145],{"class":144},"sBMFI","pnpm",[138,147,149],{"class":148},"sfazB"," nuxt",[138,151,152],{"class":148}," doctor",[138,154,155],{"class":148}," --rules",[138,157,158],{"class":148}," nuxt\u002Fstate\u002Fno-diverging-usestate-init\n",[123,160,162],{"id":161},"why-it-matters","Why it matters",[164,165,166,169],"p",{},[135,167,168],{},"useState(key, init)"," runs init only while the key has no value. Once one initializer sets the value, the others are ignored, so route and render order can change the starting value. Doctor compares initializers for string-literal keys within each Nuxt app and its layers, ignoring formatting that does not change the parsed syntax. Read-only calls and dynamic keys are not reported.",[123,171,173],{"id":172},"recommended-fix","Recommended fix",[164,175,176,177,180,181,183],{},"Put the state in one composable, such as export const useCount = () => ",[135,178,179],{},"useState('count', ()"," => 0), and call it everywhere instead of repeating ",[135,182,168],{},". If the call sites mean different state, give each its own key rather than aligning the initializers.",[123,185,187],{"id":186},"useful-links","Useful links",[189,190,191,200,207],"ul",{},[192,193,194],"li",{},[195,196,199],"a",{"href":115,"rel":197},[198],"nofollow","Rule reference",[192,201,202],{},[195,203,206],{"href":204,"rel":205},"https:\u002F\u002Fnuxt.com\u002Fdocs\u002F4.x\u002Fapi\u002Futils\u002Fclear-nuxt-state",[198],"Nuxt clearNuxtState",[192,208,209],{},[195,210,213],{"href":211,"rel":212},"https:\u002F\u002Fnuxt.com\u002Fdocs\u002F4.x\u002Fgetting-started\u002Fstate-management",[198],"Nuxt state management",[123,215,217],{"id":216},"example","Example",[219,220,222],"h3",{"id":221},"initialize-the-state-in-one-composable","Initialize the state in one composable",[164,224,225],{},"Before",[128,227,231],{"className":228,"code":229,"language":230,"meta":133,"style":133},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","\u002F\u002F app\u002Fpages\u002Findex.vue\nconst count = useState('count', () => 0)\n\n\u002F\u002F app\u002Fcomponents\u002FCounter.vue\nconst count = useState('count', () => 10)\n","ts",[135,232,233,239,285,292,298],{"__ignoreMap":133},[138,234,235],{"class":140,"line":141},[138,236,238],{"class":237},"sHwdD","\u002F\u002F app\u002Fpages\u002Findex.vue\n",[138,240,242,246,250,254,258,261,264,267,269,272,275,278,282],{"class":140,"line":241},2,[138,243,245],{"class":244},"spNyl","const",[138,247,249],{"class":248},"sTEyZ"," count ",[138,251,253],{"class":252},"sMK4o","=",[138,255,257],{"class":256},"s2Zo4"," useState",[138,259,260],{"class":248},"(",[138,262,263],{"class":252},"'",[138,265,266],{"class":148},"count",[138,268,263],{"class":252},[138,270,271],{"class":252},",",[138,273,274],{"class":252}," ()",[138,276,277],{"class":244}," =>",[138,279,281],{"class":280},"sbssI"," 0",[138,283,284],{"class":248},")\n",[138,286,288],{"class":140,"line":287},3,[138,289,291],{"emptyLinePlaceholder":290},true,"\n",[138,293,295],{"class":140,"line":294},4,[138,296,297],{"class":237},"\u002F\u002F app\u002Fcomponents\u002FCounter.vue\n",[138,299,301,303,305,307,309,311,313,315,317,319,321,323,326],{"class":140,"line":300},5,[138,302,245],{"class":244},[138,304,249],{"class":248},[138,306,253],{"class":252},[138,308,257],{"class":256},[138,310,260],{"class":248},[138,312,263],{"class":252},[138,314,266],{"class":148},[138,316,263],{"class":252},[138,318,271],{"class":252},[138,320,274],{"class":252},[138,322,277],{"class":244},[138,324,325],{"class":280}," 10",[138,327,284],{"class":248},[164,329,330],{},"After",[128,332,334],{"className":228,"code":333,"language":230,"meta":133,"style":133},"\u002F\u002F app\u002Fcomposables\u002FuseCount.ts\nexport const useCount = () => useState('count', () => 0)\n\n\u002F\u002F app\u002Fpages\u002Findex.vue, app\u002Fcomponents\u002FCounter.vue\nconst count = useCount()\n",[135,335,336,341,379,383,388],{"__ignoreMap":133},[138,337,338],{"class":140,"line":141},[138,339,340],{"class":237},"\u002F\u002F app\u002Fcomposables\u002FuseCount.ts\n",[138,342,343,347,350,353,355,357,359,361,363,365,367,369,371,373,375,377],{"class":140,"line":241},[138,344,346],{"class":345},"s7zQu","export",[138,348,349],{"class":244}," const",[138,351,352],{"class":248}," useCount ",[138,354,253],{"class":252},[138,356,274],{"class":252},[138,358,277],{"class":244},[138,360,257],{"class":256},[138,362,260],{"class":248},[138,364,263],{"class":252},[138,366,266],{"class":148},[138,368,263],{"class":252},[138,370,271],{"class":252},[138,372,274],{"class":252},[138,374,277],{"class":244},[138,376,281],{"class":280},[138,378,284],{"class":248},[138,380,381],{"class":140,"line":287},[138,382,291],{"emptyLinePlaceholder":290},[138,384,385],{"class":140,"line":294},[138,386,387],{"class":237},"\u002F\u002F app\u002Fpages\u002Findex.vue, app\u002Fcomponents\u002FCounter.vue\n",[138,389,390,392,394,396,399],{"class":140,"line":300},[138,391,245],{"class":244},[138,393,249],{"class":248},[138,395,253],{"class":252},[138,397,398],{"class":256}," useCount",[138,400,401],{"class":248},"()\n",[403,404,405],"style",{},"html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}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 .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 .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}",{"title":133,"searchDepth":241,"depth":241,"links":407},[408,409,410,411,412],{"id":125,"depth":241,"text":126},{"id":161,"depth":241,"text":162},{"id":172,"depth":241,"text":173},{"id":186,"depth":241,"text":187},{"id":216,"depth":241,"text":217,"children":413},[414],{"id":221,"depth":287,"text":222},"Finds a useState() key that two or more call sites initialize with different functions.",[114],"md","nuxt",{},{"title":421},"Diverging useState","\u002Fnuxt\u002Frules\u002Fstate\u002Fno-diverging-usestate-init","Put the state in one composable, such as export const useCount = () => useState('count', () => 0), and call it everywhere instead of repeating useState(key, init). If the call sites mean different state, give each its own key rather than aligning the initializers.",{"title":106,"description":415},"nuxt\u002Frules\u002Fstate\u002Fno-diverging-usestate-init","useState(key, init) runs init only while the key has no value. Once one initializer sets the value, the others are ignored, so route and render order can change the starting value. Doctor compares initializers for string-literal keys within each Nuxt app and its layers, ignoring formatting that does not change the parsed syntax. Read-only calls and dynamic keys are not reported.","RwoHDVFKcARwYXP5vQm4wpVzz6wXa2iehgpScE5ZbUo",1796507768915,"e745db9b-2064-477e-b678-8c0a05edc39c"]