mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: dispose group controller
This commit is contained in:
parent
1d6f74180f
commit
96be3c6ebe
@ -1,10 +1,10 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { DatabaseController } from '../../../stores/effects/database/database_controller';
|
||||
import { databaseActions, DatabaseFieldMap, IDatabaseColumn } from '../../../stores/reducers/database/slice';
|
||||
import { useAppDispatch } from '../../../stores/store';
|
||||
import { DatabaseController } from '$app/stores/effects/database/database_controller';
|
||||
import { databaseActions, DatabaseFieldMap, IDatabaseColumn } from '$app/stores/reducers/database/slice';
|
||||
import { useAppDispatch } from '$app/stores/store';
|
||||
import loadField from './loadField';
|
||||
import { FieldInfo } from '../../../stores/effects/database/field/field_controller';
|
||||
import { RowInfo } from '../../../stores/effects/database/row/row_cache';
|
||||
import { FieldInfo } from '$app/stores/effects/database/field/field_controller';
|
||||
import { RowInfo } from '$app/stores/effects/database/row/row_cache';
|
||||
import { ViewLayoutTypePB } from '@/services/backend';
|
||||
import { DatabaseGroupController } from '$app/stores/effects/database/group/group_controller';
|
||||
|
||||
@ -19,7 +19,6 @@ export const useDatabase = (viewId: string, type?: ViewLayoutTypePB) => {
|
||||
const c = new DatabaseController(viewId);
|
||||
setController(c);
|
||||
|
||||
// dispose is causing an error
|
||||
return () => void c.dispose();
|
||||
}, [viewId]);
|
||||
|
||||
|
@ -146,6 +146,9 @@ export class DatabaseController {
|
||||
};
|
||||
|
||||
dispose = async () => {
|
||||
this.groups.value.forEach((group) => {
|
||||
void group.dispose();
|
||||
});
|
||||
await this.backendService.closeDatabase();
|
||||
await this.fieldController.dispose();
|
||||
await this.databaseViewCache.dispose();
|
||||
|
@ -1,10 +1,4 @@
|
||||
import {
|
||||
DatabaseNotification,
|
||||
FlowyError,
|
||||
GroupPB,
|
||||
GroupRowsNotificationPB,
|
||||
RowPB,
|
||||
} from '@/services/backend';
|
||||
import { DatabaseNotification, FlowyError, GroupPB, GroupRowsNotificationPB, RowPB } from '@/services/backend';
|
||||
import { ChangeNotifier } from '$app/utils/change_notifier';
|
||||
import { None, Ok, Option, Result, Some } from 'ts-results';
|
||||
import { DatabaseNotificationObserver } from '../notifications/observer';
|
||||
|
Loading…
Reference in New Issue
Block a user