Skip to content

Commit

Permalink
Don't put empty record into thing
Browse files Browse the repository at this point in the history
  • Loading branch information
kwahlin committed Nov 12, 2024
1 parent 6f75910 commit 49b735d
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,12 @@ private Map<?,?> makePreviewChangeSet(RecordedChange recordChange) {
recordAfter.remove(ID_KEY);

// We want to compute the diff for a "framed" thing
thingBefore.put(RECORD_KEY, recordBefore);
thingAfter.put(RECORD_KEY, recordAfter);
if (!recordBefore.isEmpty()) {
thingBefore.put(RECORD_KEY, recordBefore);
}
if (!recordAfter.isEmpty()) {
thingAfter.put(RECORD_KEY, recordAfter);
}

// However when the diff is computed we need "@graph form", hence the same record copy at @graph,0 in both versions
var beforeDoc = new Document(Map.of(GRAPH_KEY, List.of(recordCopy, thingBefore)));
Expand Down

0 comments on commit 49b735d

Please sign in to comment.