mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-11-30 20:09:50 +03:00
Fix broken project switching
- related to `observableToStore` functionality
This commit is contained in:
parent
fee036fc7d
commit
e49bf7a4ef
@ -12,8 +12,14 @@ export function observableToStore<T>(
|
||||
): [Readable<T | undefined>, Readable<string | undefined>] {
|
||||
let unsubscribe: any = undefined;
|
||||
|
||||
const store = writable<T | undefined>(undefined, () => unsubscribe);
|
||||
const error = writable<string | undefined>();
|
||||
const store = writable<T | undefined>(undefined, () => {
|
||||
// This runs when the last subscriber unsubscribes
|
||||
return () => {
|
||||
// TODO: Investigate why project switching breaks without `setTimeout`
|
||||
setTimeout(() => unsubscribe(), 0);
|
||||
};
|
||||
});
|
||||
const error = writable<string>();
|
||||
|
||||
const subscription = observable
|
||||
.pipe(
|
||||
|
Loading…
Reference in New Issue
Block a user