Skip to content

Commit

Permalink
Handle nulls in decorate
Browse files Browse the repository at this point in the history
  • Loading branch information
aravindet committed Feb 21, 2024
1 parent b896282 commit 8f1ff1e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/common/coding/decorate.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export default function decorate(rootGraph, rootQuery) {
.map((node) => {
const $key = decodeArgs(node);
const subResult = construct(getValue(node), subQuery);
if (typeof subResult === 'object') {
if (typeof subResult === 'object' && subResult) {
subResult.$key =
children[PRE] && !isMinKey(children[PRE])
? { ...children[PRE], $cursor: $key }
Expand Down Expand Up @@ -136,7 +136,7 @@ export default function decorate(rootGraph, rootQuery) {

if (node.path) {
result = unwrap(rootGraph, node.path);
if (typeof result === 'object') result[REF] = node.path;
if (typeof result === 'object' && result) result[REF] = node.path;
} else {
result = getNodeValue(node);
}
Expand Down

0 comments on commit 8f1ff1e

Please sign in to comment.