{"record":{"id":"05069192ca852d25","repo":"DioxusLabs/dioxus","slug":"goforwardbutton-must-have-access-to-a-parent-rou","errorCode":null,"errorMessage":"`GoForwardButton` must have access to a parent router","messagePattern":"`GoForwardButton` must have access to a parent router","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/router/src/components/history_buttons.rs","lineNumber":144,"sourceCode":"/// # let mut vdom = VirtualDom::new(App);\n/// # vdom.rebuild_in_place();\n/// # assert_eq!(\n/// #     dioxus_ssr::render(&vdom),\n/// #     r#\"<button disabled=\"true\">go forward</button>\"#\n/// # );\n/// ```\npub fn GoForwardButton(props: HistoryButtonProps) -> Element {\n    let HistoryButtonProps { children } = props;\n\n    // hook up to router\n    let router = match use_router_internal() {\n        Some(r) => r,\n        #[allow(unreachable_code)]\n        None => {\n            let msg = \"`GoForwardButton` must have access to a parent router\";\n            error!(\"{msg}, will be inactive\");\n            #[cfg(debug_assertions)]\n            panic!(\"{}\", msg);\n            return VNode::empty();\n        }\n    };\n\n    let disabled = !router.can_go_forward();\n\n    rsx! {\n        button {\n            disabled: \"{disabled}\",\n            onclick: move |evt| {\n                evt.prevent_default();\n                router.go_forward()\n            },\n            {children}\n        }\n    }\n}\n","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/24f6a829df0dfa203961a98ea4cae21c2ff27e28/packages/router/src/components/history_buttons.rs#L126-L162","documentation":"GoForwardButton called use_router_internal() and received None because it was rendered outside a Router subtree. Without router context the button cannot navigate; debug builds panic and release builds render it inactive.","triggerScenarios":"Thrown at packages/router/src/components/history_buttons.rs:144 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Render GoForwardButton inside a Router component so it can access the router context."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"24f6a829df0dfa203961a98ea4cae21c2ff27e28","analyzedAt":"2026-08-23T07:10:14.078Z","contentChangedAt":"2026-08-23T07:10:14.078Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}