Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: PouchStorageTable using incorrect $ne operator #2011

Merged
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions packages/pouch-storage/src/PouchStorageTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,18 @@ export type PouchDBSort = Array<
string | { [propName: string]: 'asc' | 'desc' }
>;

// We may want to use `PouchDB.Find.ConditionOperators` instead of this, but
// there are some mismatches in how we use this with the types.
// https://github.com/deephaven/web-client-ui/issues/1505 to address this
type PouchFilter = OnlyOneProp<{
$eq: FilterValue | FilterValue[];
$neq: FilterValue | FilterValue[];
$ne: FilterValue | FilterValue[];
$gt: FilterValue | FilterValue[];
$gte: FilterValue | FilterValue[];
$lt: FilterValue | FilterValue[];
$lte: FilterValue | FilterValue[];
$regex: RegExp;
}>;
$regex: RegExp | string;
}> &
Omit<PouchDB.Find.ConditionOperators, '$regex'>;
AkshatJawne marked this conversation as resolved.
Show resolved Hide resolved

function makePouchFilter(
export function makePouchFilter(
AkshatJawne marked this conversation as resolved.
Show resolved Hide resolved
type: string,
value: FilterValue | FilterValue[]
): PouchFilter {
Expand All @@ -61,8 +59,7 @@ function makePouchFilter(
case FilterType.eq:
return { $eq: value };
case FilterType.notEq:
// This should be `$ne` https://github.com/deephaven/web-client-ui/issues/1505
return { $neq: value };
return { $ne: value };
case FilterType.greaterThan:
return { $gt: value };
case FilterType.greaterThanOrEqualTo:
Expand Down
Loading