feat(ui): use keyed show to re-render Machine route when route changes
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import { RouteSectionProps, useNavigate } from "@solidjs/router";
|
import { RouteSectionProps, useNavigate } from "@solidjs/router";
|
||||||
import { SidebarPane } from "@/src/components/Sidebar/SidebarPane";
|
import { SidebarPane } from "@/src/components/Sidebar/SidebarPane";
|
||||||
import { navigateToClan, useClanURI, useMachineName } from "@/src/hooks/clan";
|
import { navigateToClan, useClanURI, useMachineName } from "@/src/hooks/clan";
|
||||||
|
import { Show } from "solid-js";
|
||||||
|
|
||||||
export const Machine = (props: RouteSectionProps) => {
|
export const Machine = (props: RouteSectionProps) => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@@ -11,9 +12,13 @@ export const Machine = (props: RouteSectionProps) => {
|
|||||||
navigateToClan(navigate, clanURI);
|
navigateToClan(navigate, clanURI);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const machineName = useMachineName();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SidebarPane title={useMachineName()} onClose={onClose}>
|
<Show when={useMachineName()} keyed>
|
||||||
<h1>Hello world</h1>
|
<SidebarPane title={useMachineName()} onClose={onClose}>
|
||||||
</SidebarPane>
|
<h1>Hello world</h1>
|
||||||
|
</SidebarPane>
|
||||||
|
</Show>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user