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 { SidebarPane } from "@/src/components/Sidebar/SidebarPane";
|
||||
import { navigateToClan, useClanURI, useMachineName } from "@/src/hooks/clan";
|
||||
import { Show } from "solid-js";
|
||||
|
||||
export const Machine = (props: RouteSectionProps) => {
|
||||
const navigate = useNavigate();
|
||||
@@ -11,9 +12,13 @@ export const Machine = (props: RouteSectionProps) => {
|
||||
navigateToClan(navigate, clanURI);
|
||||
};
|
||||
|
||||
const machineName = useMachineName();
|
||||
|
||||
return (
|
||||
<SidebarPane title={useMachineName()} onClose={onClose}>
|
||||
<h1>Hello world</h1>
|
||||
</SidebarPane>
|
||||
<Show when={useMachineName()} keyed>
|
||||
<SidebarPane title={useMachineName()} onClose={onClose}>
|
||||
<h1>Hello world</h1>
|
||||
</SidebarPane>
|
||||
</Show>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user