Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

chore: fix tauri build

nathan24340f30910b
diff --git a/frontend/appflowy_tauri/src/appflowy_app/stores/effects/database/cell/cell_controller.ts b/frontend/appflowy_tauri/src/appflowy_app/stores/effects/database/cell/cell_controller.ts
index 6d3050d88a..853bc2f006 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/stores/effects/database/cell/cell_controller.ts
+++ b/frontend/appflowy_tauri/src/appflowy_app/stores/effects/database/cell/cell_controller.ts
@@ -1,6 +1,5 @@
import { CellIdentifier } from './cell_bd_svc';
import { CellCache, CellCacheKey } from './cell_cache';
-import { FieldController } from '../field/field_controller';
import { CellDataLoader } from './data_parser';
import { CellDataPersistence } from './data_persistence';
import { FieldBackendService, TypeOptionParser } from '../field/field_bd_svc';
@@ -112,21 +111,24 @@ export class CellController<T, D> {
}
class CellDataNotifier<T> extends ChangeNotifier<T | null> {
- _cellData: T | null;
+ _cellData: Option<T>;
constructor(cellData: T) {
super();
- this._cellData = cellData;
+ this._cellData = Some(cellData);
}
- set cellData(data: T | null) {
+ set cellData(data: Option<T>) {
if (this._cellData !== data) {
this._cellData = data;
- this.notify(this._cellData);
+
+ if (this._cellData.some) {
+ this.notify(this._cellData.val);
+ }
}
}
- get cellData(): T | null {
+ get cellData(): Option<T> {
return this._cellData;
}
}
diff --git a/frontend/appflowy_tauri/src/appflowy_app/stores/effects/database/cell/data_parser.ts b/frontend/appflowy_tauri/src/appflowy_app/stores/effects/database/cell/data_parser.ts
index e44867c0df..20a7a3e68d 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/stores/effects/database/cell/data_parser.ts
+++ b/frontend/appflowy_tauri/src/appflowy_app/stores/effects/database/cell/data_parser.ts
@@ -3,11 +3,11 @@ import { CellBackendService, CellIdentifier } from './cell_bd_svc';
import { DateCellDataPB } from '../../../../../services/backend/models/flowy-database/date_type_option_entities';
import { SelectOptionCellDataPB } from '../../../../../services/backend/models/flowy-database/select_type_option';
import { URLCellDataPB } from '../../../../../services/backend/models/flowy-database/url_type_option_entities';
-import { Err, Ok } from 'ts-results';
+import { Err, None, Ok, Option, Some } from 'ts-results';
import { Log } from '../../../../utils/log';
abstract class CellDataParser<T> {
- abstract parserData(data: Uint8Array): T;
+ abstract parserData(data: Uint8Array): Option<T>;
}
class CellDataLoader<T> {
@@ -34,32 +34,32 @@ export const utf8Decoder = new TextDecoder('utf-8');
export const utf8Encoder = new TextEncoder();
class StringCellDataParser extends CellDataParser<string> {
- parserData(data: Uint8Array): string {
- return utf8Decoder.decode(data);
+ parserData(data: Uint8Array): Option<string> {
+ return Some(utf8Decoder.decode(data));
}
}
class DateCellDataParser extends CellDataParser<DateCellDataPB> {
- parserData(data: Uint8Array): DateCellDataPB {
- return DateCellDataPB.deserializeBinary(data);
+ parserData(data: Uint8Array): Option<DateCellDataPB> {
+ return Some(DateCellDataPB.deserializeBinary(data));
}
}
-class SelectOptionCellDataParser extends CellDataParser<SelectOptionCellDataPB | undefined> {
- parserData(data: Uint8Array): SelectOptionCellDataPB | undefined {
+class SelectOptionCellDataParser extends CellDataParser<SelectOptionCellDataPB> {
+ parserData(data: Uint8Array): Option<SelectOptionCellDataPB> {
if (data.length === 0) {
- return undefined;
+ return None;
}
- return SelectOptionCellDataPB.deserializeBinary(data);
+ return Some(SelectOptionCellDataPB.deserializeBinary(data));
}
}
-class URLCellDataParser extends CellDataParser<URLCellDataPB | undefined> {
- parserData(data: Uint8Array): URLCellDataPB | undefined {
+class URLCellDataParser extends CellDataParser<URLCellDataPB> {
+ parserData(data: Uint8Array): Option<URLCellDataPB> {
if (data.length === 0) {
- return undefined;
+ return None;
}
- return URLCellDataPB.deserializeBinary(data);
+ return Some(URLCellDataPB.deserializeBinary(data));
}
}