interface: reset state on clog

This commit is contained in:
Liam Fitzgerald 2021-07-22 12:51:13 +10:00
parent ef4cdca187
commit e015e6930a
No known key found for this signature in database
GPG Key ID: D390E12C61D1CFFB

View File

@ -3,7 +3,7 @@ import { compose } from 'lodash/fp';
import _ from 'lodash';
import create, { GetState, SetState, UseStore } from 'zustand';
import { persist } from 'zustand/middleware';
import Urbit, { SubscriptionRequestInterface } from '@urbit/http-api';
import Urbit, { SubscriptionRequestInterface, FatalError } from '@urbit/http-api';
import { Poke } from '@urbit/api';
import airlock from '~/logic/api';
@ -102,7 +102,9 @@ export function createSubscription(app: string, path: string, e: (data: any) =>
path,
event: e,
err: () => {},
quit: () => {}
quit: () => {
throw new FatalError('subscription clogged');
}
};
// TODO: err, quit handling (resubscribe?)
return request;