createTimelineControlsForArray: catch error

This commit is contained in:
thislight 2024-11-04 18:03:53 +08:00
parent c22860a7e3
commit 97a1fb9cf1
No known key found for this signature in database
GPG key ID: FCFE5192241CCD4E

View file

@ -26,7 +26,9 @@ export function createTimelineControlsForArray(
const [threads, setThreads] = createStore([] as mastodon.v1.Status["id"][]); const [threads, setThreads] = createStore([] as mastodon.v1.Status["id"][]);
createEffect(() => { createEffect(() => {
const nls = status(); const nls = catchError(status, (e) => {
console.error(e);
});
if (!nls) return; if (!nls) return;
setThreads([]); setThreads([]);
@ -226,9 +228,7 @@ export type TimelineControls = {
set(id: string, value: mastodon.v1.Status): void; set(id: string, value: mastodon.v1.Status): void;
}; };
export type TimelineResource< export type TimelineResource<R> = [
R,
> = [
TimelineControls, TimelineControls,
Resource<R>, Resource<R>,
{ refetch(info?: TimelineFetchDirection): void }, { refetch(info?: TimelineFetchDirection): void },
@ -238,7 +238,7 @@ export type TimelineResource<
* Create auto managed timeline controls. * Create auto managed timeline controls.
* *
* The error from the resource is not thrown in the * The error from the resource is not thrown in the
* {@link TimelineControls.list} and {@link TimelineControls}.get*. * {@link TimelineControls["list"]} and {@link TimelineControls}.get*.
* Use the second value from {@link TimelineResource} to catch the error. * Use the second value from {@link TimelineResource} to catch the error.
*/ */
export function createTimeline< export function createTimeline<