feat: integrate client and server sharing workflows
This commit is contained in:
1 parent
42b93ae2d8
commit
7406e2fe37
101 files changed
+3153
-253
No files matched your search
@@ -16,6 +16,7 @@ export interface WorkspaceData {
|
||||
/** 新的在前 */
|
||||
order: string[];
|
||||
snapshot: Snapshot;
|
||||
error: string | null;
|
||||
}
|
||||
|
||||
export const initialData: WorkspaceData = {
|
||||
@@ -26,6 +27,7 @@ export const initialData: WorkspaceData = {
|
||||
byId: {},
|
||||
order: [],
|
||||
snapshot: { text: '', updatedBy: '', updatedAt: 0 },
|
||||
error: null,
|
||||
};
|
||||
|
||||
function insertByTime(order: string[], byId: Record<string, Item>, item: Item): string[] {
|
||||
@@ -37,6 +39,10 @@ function insertByTime(order: string[], byId: Record<string, Item>, item: Item):
|
||||
|
||||
export function reduce(s: WorkspaceData, e: WorkspaceEvent): WorkspaceData {
|
||||
switch (e.t) {
|
||||
case 'reset':
|
||||
return { ...initialData, connection: s.connection };
|
||||
case 'error':
|
||||
return { ...s, error: e.message };
|
||||
case 'ready':
|
||||
return { ...s, ready: true };
|
||||
case 'connection':
|
||||
|
||||
Reference in new issue
Block a user