-
-
Notifications
You must be signed in to change notification settings - Fork 643
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
Can't put middleware higher than Dexie Cloud #2047
Comments
The level param will only order the middleware differently to be called before or after other middlewares. There is no way to generically jump over another middleware since the down-level (or next) middleware has to be called to eventually reach the lowest level. The sync engine does not origin from within a middleware. Middleware is there to track mutations and other things though. But I think you should be able to detect whether an operation was initiated by the user or from a sync operation. If trans.disableChangeTracking is true (that property is not typed so you'd have to |
Neat! I was wondering if such a property existed but didn't notice that one. I tried that just now and it seems to work, except for a case that I can't seem to reproduce, which I saw right at the beginning of my testing, where that property was falsy for an insertion that originated from dexie-cloud-addon. Are there any cases where an entity is added by the dexie-cloud-addon but it doesn't set |
Yes when storing dexie-cloud data in tables starting with |
That makes sense! Thanks for your help. |
I have a custom middleware that I want to run only on user operations and not on operations that are performed by the Dexie Cloud addon. E.g. if the user creates an entity in the app, this middleware should be invoked. When that entity gets synced to another device, it should not be, even though it's being created there (by
dexie-cloud-addon
) for the first time.I tried to set the
level
param of my custom middleware to2
as was done in this POC of using dexie-encrypted with Dexie Cloud, but it doesn't seem to be working; the middleware is still called on operations that are triggered by Dexie Cloud.What am I missing?
The text was updated successfully, but these errors were encountered: