Skip to content

Commit 2657811

Browse files
authored
Use lodash for deep cloning (#489)
* Use lodash temporarily for deep cloning * Vendor lodash cloneDeep
1 parent f96047a commit 2657811

File tree

4 files changed

+1445
-3
lines changed

4 files changed

+1445
-3
lines changed

Diff for: codegenerator/cli/templates/static/codegen/src/InMemoryStore.res

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ let clone = (self: t) => {
6565
eventSyncState: self.eventSyncState->InMemoryTable.clone,
6666
rawEvents: self.rawEvents->InMemoryTable.clone,
6767
entities: self.entities->EntityTables.clone,
68-
rollBackEventIdentifier: self.rollBackEventIdentifier->InMemoryTable.structuredClone,
68+
rollBackEventIdentifier: self.rollBackEventIdentifier->Lodash.cloneDeep,
6969
}
7070

7171
let getInMemTable = (

Diff for: codegenerator/cli/templates/static/codegen/src/InMemoryTable.res

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@ let get = (self: t<'key, 'val>, key: 'key) =>
1414

1515
let values = (self: t<'key, 'val>) => self.dict->Js.Dict.values
1616

17-
@val external structuredClone: 'a => 'a = "structuredClone"
1817
let clone = (self: t<'key, 'val>) => {
1918
...self,
20-
dict: self.dict->structuredClone,
19+
dict: self.dict->Lodash.cloneDeep,
2120
}
2221

2322
module Entity = {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// TODO: Remove this file once we have our own impl of cloneDeep or it is no longer needed
2+
@module("./vendored-lodash-fns.js") external cloneDeep: 'a => 'a = "cloneDeep"

0 commit comments

Comments
 (0)