fix: add keyed prop to Show components for proper reactivity (#23935)

This commit is contained in:
Brendan Allan
2026-04-23 17:32:01 +08:00
committed by GitHub
parent a419f1c50f
commit 785f3589ab
2 changed files with 5 additions and 5 deletions
@@ -269,10 +269,10 @@ export const SessionItem = (props: SessionItemProps): JSX.Element => {
</Show> </Show>
</div> </div>
</div> </div>
<Show when={currentChild()}> <Show when={currentChild()} keyed>
{(child) => ( {(child) => (
<div class="w-full"> <div class="w-full">
<SessionItem {...props} session={child()} level={(props.level ?? 0) + 1} /> <SessionItem {...props} session={child} level={(props.level ?? 0) + 1} />
</div> </div>
)} )}
</Show> </Show>
@@ -812,7 +812,7 @@ export function MessageTimeline(props: {
</Show> </Show>
</div> </div>
</div> </div>
<Show when={sessionID()}> <Show when={sessionID()} keyed>
{(id) => ( {(id) => (
<div class="shrink-0 flex items-center gap-3"> <div class="shrink-0 flex items-center gap-3">
<SessionContextUsage placement="bottom" /> <SessionContextUsage placement="bottom" />
@@ -878,12 +878,12 @@ export function MessageTimeline(props: {
</DropdownMenu.ItemLabel> </DropdownMenu.ItemLabel>
</DropdownMenu.Item> </DropdownMenu.Item>
</Show> </Show>
<DropdownMenu.Item onSelect={() => void archiveSession(id())}> <DropdownMenu.Item onSelect={() => void archiveSession(id)}>
<DropdownMenu.ItemLabel>{language.t("common.archive")}</DropdownMenu.ItemLabel> <DropdownMenu.ItemLabel>{language.t("common.archive")}</DropdownMenu.ItemLabel>
</DropdownMenu.Item> </DropdownMenu.Item>
<DropdownMenu.Separator /> <DropdownMenu.Separator />
<DropdownMenu.Item <DropdownMenu.Item
onSelect={() => dialog.show(() => <DialogDeleteSession sessionID={id()} />)} onSelect={() => dialog.show(() => <DialogDeleteSession sessionID={id} />)}
> >
<DropdownMenu.ItemLabel>{language.t("common.delete")}</DropdownMenu.ItemLabel> <DropdownMenu.ItemLabel>{language.t("common.delete")}</DropdownMenu.ItemLabel>
</DropdownMenu.Item> </DropdownMenu.Item>