-
Hi, try to implement two hooks
Modify obj works fine, but stop db transaction fails. And I have no idea, how to trigger an update from inside of the deleting hook and skip deleting entry. |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 3 replies
-
Found the solution for skip creating by |
Beta Was this translation helpful? Give feedback.
-
Tried different ways to run a
Abort transaction works, but need to update the obj.val and save it. |
Beta Was this translation helpful? Give feedback.
-
Fixed my hook... works now
|
Beta Was this translation helpful? Give feedback.
-
your use case requires using middlewares instead of hooks. https://dexie.org/docs/Dexie/Dexie.use() With middlewares you can change the behavior completely and support async actions such as using put to downlevelTable instead of the requested delete operation. |
Beta Was this translation helpful? Give feedback.
-
Looks like create / update is working fine, but need to distinguish between create / update (values arry and type = put) and delete (type delete). Would you suggest another way than
But how to redirect delete to update transaction? My middleware test code
|
Beta Was this translation helpful? Give feedback.
-
@dfahlander How hooking read from middleware? Is there a similiar way like mutate to handle all read requests at once? |
Beta Was this translation helpful? Give feedback.
-
Hi @dfahlander, so best way is middleware instead of old hook system? Asking because of planned change subscriptions for matching keys. Looks like I found how to implement my features with middleware by query and mutate:
|
Beta Was this translation helpful? Give feedback.
Fixed my hook... works now