Changelog - 2026-10-28
useDocumentTitle takes fallback, a base title screens override
New FeatureIn one line. A layout and a screen that both called useDocumentTitle left the layout's title on the first mount, because React runs child effects before the parent's. fallback: true makes the layout's title a base that screens override. Nothing changes without the flag. In ARDOR 0.4.5.
tsx
import { useDocumentTitle } from '@venizia/ardor';
useDocumentTitle({ title: undefined, appTitle: 'Back Office', fallback: true }); // in the layout
useDocumentTitle({ title: 'Orders', appTitle: 'Back Office' }); // in a screenWhat changed
fallbackoption. A call withfallback: trueshows its title only while no call without it is mounted. The screen's title wins on the first mount, and the fallback shows again when the screen unmounts.- Two fallbacks. The one mounted last shows; when it unmounts the earlier one shows again.
- Unchanged. A call without
fallbackbehaves as before, including putting back the title it replaced and leaving a title a later writer set.
Who is affected
- An app whose layout and screens both set a title. Add
fallback: trueto the layout's call. A base title that never changes can stay in the<title>ofindex.htmlinstead. - Everyone else. Nothing to do.
See useDocumentTitle.