-
Notifications
You must be signed in to change notification settings - Fork 133
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
filter seeing inconsistent argument format #874
Comments
Ah, sorry for the confusion and breaking change. This is intentional and is explained in the WIP v0.17 docs here. There are subtle breaking changes in the In your filter I'd recommend interacting with the transform's operations as an array using this utility: import { toArray } from '@orbit/utils';
const operations = toArray(transform.operations); The same approach is recommended for evaluating |
Thanks, the singular vs plural makes sense. I still have a related ambiguity on return toArray(query.expressions).every(
(expression) =>
expression.type !== 'patient' && expression.record?.type !== 'patient'
); |
A record-specific query expression could implement any of these interfaces. To be fully inclusive of all possibilities you should be aware that If your purpose is to block certain queries from being forwarded to a source and inspection of the query expressions feels too granular, you might consider using an option that tags your queries in a particular way. For example: // at the call site
await source.query((q) => q.findRecords('patient'), { remote: 'patientServer' });
// in your strategy
filter(query) {
return query?.options?.remote === 'patientServer';
} |
Closing, but please comment if anything is unresolved. |
I have a
filter
method on aRequestStrategy
. Sometimes the first argument it receives is formatted like:And sometimes it's formatted like:
Notice that in the first one
operations
is a POJO and in the second it's an array.Is it intentional that these differ? If it's a bug, I can make a reproduction.
The text was updated successfully, but these errors were encountered: