TootList: accept id in props

This commit is contained in:
thislight 2024-11-04 17:10:12 +08:00
parent dde0c249f4
commit bdaaeadba6
No known key found for this signature in database
GPG key ID: FCFE5192241CCD4E

View file

@ -18,6 +18,7 @@ import { findElementActionable } from "./RegularToot";
const TootList: Component<{ const TootList: Component<{
ref?: Ref<HTMLDivElement>; ref?: Ref<HTMLDivElement>;
id?: string;
threads: readonly string[]; threads: readonly string[];
onUnknownThread: (id: string) => { value: mastodon.v1.Status }[] | undefined; onUnknownThread: (id: string) => { value: mastodon.v1.Status }[] | undefined;
onChangeToot: (id: string, value: mastodon.v1.Status) => void; onChangeToot: (id: string, value: mastodon.v1.Status) => void;
@ -149,7 +150,7 @@ const TootList: Component<{
return <p>Oops: {String(err)}</p>; return <p>Oops: {String(err)}</p>;
}} }}
> >
<div ref={props.ref} class="toot-list"> <div ref={props.ref} id={props.id} class="toot-list">
<For each={props.threads}> <For each={props.threads}>
{(itemId, index) => { {(itemId, index) => {
const path = props.onUnknownThread(itemId)!; const path = props.onUnknownThread(itemId)!;