createTimelineControlsForArray: catch error
This commit is contained in:
		
							parent
							
								
									c22860a7e3
								
							
						
					
					
						commit
						97a1fb9cf1
					
				
					 1 changed files with 5 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -26,7 +26,9 @@ export function createTimelineControlsForArray(
 | 
			
		|||
  const [threads, setThreads] = createStore([] as mastodon.v1.Status["id"][]);
 | 
			
		||||
 | 
			
		||||
  createEffect(() => {
 | 
			
		||||
    const nls = status();
 | 
			
		||||
    const nls = catchError(status, (e) => {
 | 
			
		||||
      console.error(e);
 | 
			
		||||
    });
 | 
			
		||||
    if (!nls) return;
 | 
			
		||||
 | 
			
		||||
    setThreads([]);
 | 
			
		||||
| 
						 | 
				
			
			@ -226,9 +228,7 @@ export type TimelineControls = {
 | 
			
		|||
  set(id: string, value: mastodon.v1.Status): void;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export type TimelineResource<
 | 
			
		||||
  R,
 | 
			
		||||
> = [
 | 
			
		||||
export type TimelineResource<R> = [
 | 
			
		||||
  TimelineControls,
 | 
			
		||||
  Resource<R>,
 | 
			
		||||
  { refetch(info?: TimelineFetchDirection): void },
 | 
			
		||||
| 
						 | 
				
			
			@ -238,7 +238,7 @@ export type TimelineResource<
 | 
			
		|||
 * Create auto managed timeline controls.
 | 
			
		||||
 *
 | 
			
		||||
 * 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.
 | 
			
		||||
 */
 | 
			
		||||
export function createTimeline<
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue