{"record":{"id":"52ced375b77dca74","repo":"leptos-rs/leptos","slug":"no-finished-property-on-viewtransition","errorCode":null,"errorMessage":"no `finished` property on ViewTransition","messagePattern":"no `finished` property on ViewTransition","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"router/src/lib.rs","lineNumber":192,"sourceCode":"        if is_back_navigation {\n            _ = class_list.add_1(\"router-back\");\n        }\n        match svt {\n            Ok(svt) => {\n                let cb = Closure::once_into_js(Box::new(move || {\n                    fun();\n                }));\n                match svt.call1(\n                    document.unchecked_ref(),\n                    cb.as_ref().unchecked_ref(),\n                ) {\n                    Ok(view_transition) => {\n                        let class_list = document_element.class_list();\n                        let finished = Reflect::get(\n                            &view_transition,\n                            &JsValue::from_str(\"finished\"),\n                        )\n                        .expect(\"no `finished` property on ViewTransition\")\n                        .unchecked_into::<Promise>();\n                        let cb = Closure::new(Box::new(move |_| {\n                            if is_back_navigation {\n                                class_list.remove_1(\"router-back\").unwrap();\n                            }\n                            class_list\n                                .remove_1(&format!(\"router-outlet-{level}\"))\n                                .unwrap();\n                        })\n                            as Box<dyn FnMut(JsValue)>);\n                        _ = finished.then(&cb);\n                        cb.into_js_value();\n                    }\n                    Err(e) => {\n                        web_sys::console::log_1(&e);\n                    }\n                }\n            }","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/leptos-rs/leptos/blob/32d20f6c9d517451d77beb68d88c7716823dac41/router/src/lib.rs#L174-L210","documentation":"During navigation the router uses the browser's View Transitions API and reads `viewTransition.finished` via `Reflect::get`, expecting a Promise. If the returned object does not expose `finished` (unsupported/partially implemented browser, or a mocked/undefined return from `document.startViewTransition`), the `expect` panics.","triggerScenarios":"Navigating with `ViewTransition` enabled in a browser whose `document.startViewTransition` returns an object lacking `finished`; environments (older Safari/Firefox versions, some webviews, jsdom/test setups) with incomplete View Transitions support.","commonSituations":"Enabling view transitions globally and testing on a browser or headless environment without full API support; polyfills or shims that return a stub instead of a real ViewTransition; partial implementations that expose startViewTransition but not the finished promise.","solutions":["Feature-detect full support and disable view transitions when unavailable: check `document.startViewTransition` exists and that the result has a `finished` property before using it.","Update/avoid the problematic browser or test environment; use a real browser with complete View Transitions support.","Remove/condition the `transition` NavigateOptions so navigation falls back to non-view-transition rendering."],"exampleFix":"// before\nlet support = document.start_view_transition.is_some();\nnavigate_with_options(\"/next\", NavigateOptions { transition: true, .. });\n\n// after\nlet vt_ok = js!(return !!(document.startViewTransition &&\n  document.startViewTransition(() => {}).finished);).is_truthy();\nNavigateOptions { transition: vt_ok, ..Default::default() }","handlingStrategy":"type-guard","validationCode":"// Detect full View Transitions support before enabling:\nlet vt_supported = window()\n    .and_then(|w| w.get(\"document\").ok())\n    .map(|d| d.get(\"startViewTransition\").map(|f| f.is_function()).unwrap_or(false))\n    .unwrap_or(false);","typeGuard":"fn supports_view_transitions() -> bool {\n    window().map(|w| Reflect::has(&w, &\"document\".into())).unwrap_or(false)\n        && js!(return typeof document.startViewTransition === \"function\";).is_truthy()\n}","tryCatchPattern":"// Wrap view-transition navigation:\nif supports_view_transitions() {\n    navigate_with_options(path, NavigateOptions { transition: true, ..Default::default() });\n} else {\n    navigate(path);\n}","preventionTips":["Feature-detect View Transitions API before enabling the `transition` option.","Avoid enabling view transitions in tests/headless environments without support.","Track browser support matrix for the View Transitions API."],"tags":["browser-api","view-transitions","wasm","leptos"],"backgroundTag":"missing-browser-api-property","analyzedSha":"32d20f6c9d517451d77beb68d88c7716823dac41","analyzedAt":"2026-09-01T18:55:42.580Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T01:17:15.007Z"}