Skip to content

Commit

Permalink
do not throw ambigurous error if all the parsed results are the same
Browse files Browse the repository at this point in the history
  • Loading branch information
sywhb committed Dec 21, 2023
1 parent 78307b7 commit 93de374
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/liqe/src/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,14 @@ export const parse = (query: string): LiqeQuery => {
}

if (results.length > 1) {
throw new Error('Ambiguous results.');
// check if all results are the same
const firstResult = JSON.stringify(results[0]);

for (const result of results) {
if (JSON.stringify(result) !== firstResult) {
throw new Error('Ambiguous results.');
}
}
}

const hydratedAst = hydrateAst(results[0]);
Expand Down

1 comment on commit 93de374

@gajus
Copy link

@gajus gajus commented on 93de374 Jan 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been ported upstream in gajus/liqe@78dd7f1

Please sign in to comment.