Skip to content

Commit

Permalink
Merge pull request #3271 from omnivore-app/fix/ambigurous-search-result
Browse files Browse the repository at this point in the history
do not throw ambiguous error if all the parsed results are the same
  • Loading branch information
sywhb authored Dec 21, 2023
2 parents 78307b7 + 93de374 commit e9f0725
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 e9f0725

@vercel
Copy link

@vercel vercel bot commented on e9f0725 Dec 21, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.