Skip to content

Commit

Permalink
Fix lint issues and add new file header
Browse files Browse the repository at this point in the history
  • Loading branch information
sw-joelmut committed Jul 19, 2023
1 parent fd91340 commit 1d2bfa2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Composer/packages/client/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ export const App: React.FC = () => {
}, [appLocale]);

useEffect(() => {
lgWorker.listen(LgEventType.OnUpdateLgFile, msg => {
lgWorker.listen(LgEventType.OnUpdateLgFile, (msg) => {
const { projectId, payload } = msg.data;
updateFile({ projectId, value: payload });
})
});
});

useEffect(() => {
Expand Down
9 changes: 3 additions & 6 deletions Composer/packages/client/src/recoilModel/parsers/lgWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,9 @@ class LgWorker extends BaseWorker<LgActionType> {
}
}

async flush(): Promise<boolean> {
return new Promise(async (resolve) => {
this.listeners.clear();
const result = await super.flush();
resolve(result);
});
flush(): Promise<boolean> {
this.listeners.clear();
return super.flush();
}

addProject(projectId: string) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

interface MapOptimizerTree<Key> {
timestamp: number;
references: Key[];
Expand All @@ -11,15 +14,15 @@ export class MapOptimizer<Key, Value> {
public tree = new Map<Key, MapOptimizerTree<Key>>();
private skipOptimize = new Set<Key>();

opUpdateCallback?: (key: Key, value: Value, ctx: OnUpdateMapOptimizerContext<Key>) => void;
onUpdateCallback?: (key: Key, value: Value, ctx: OnUpdateMapOptimizerContext<Key>) => void;
onDeleteCallback?: (key: Key, value: Value) => void;

constructor(private capacity: number, public list: Map<Key, Value>) {
this.attach();
}

onUpdate(callback: (key: Key, value: Value, ctx: OnUpdateMapOptimizerContext<Key>) => void) {
this.opUpdateCallback = callback;
this.onUpdateCallback = callback;
}

onDelete(callback: (key: Key, value: Value) => void) {
Expand All @@ -40,7 +43,7 @@ export class MapOptimizer<Key, Value> {
private optimize(keyToAdd: Key, valueToAdd: Value) {
const exists = this.tree.has(keyToAdd);
const context: MapOptimizerTree<Key> = { timestamp: Date.now(), references: [] };
this.opUpdateCallback?.(keyToAdd, valueToAdd, {
this.onUpdateCallback?.(keyToAdd, valueToAdd, {
setReferences: (references) => (context.references = references || []),
});
this.tree.set(keyToAdd, context);
Expand Down

0 comments on commit 1d2bfa2

Please sign in to comment.