fix(09): WR-19 expose the write transaction to hooks and scopes through TxFromContext
This commit is contained in:
@@ -217,6 +217,8 @@ Behaviour overrides such as `formBeforeCreate` or `listExtendQuery` become optio
|
||||
| `pact.FormBeforeDelete`, `pact.FormAfterDelete` | Around a delete, inside its transaction. |
|
||||
| `pact.DropdownOptionsProvider` | Supplies the options of a `dropdown` field that names a method. |
|
||||
|
||||
A hook or scope that has to read the database during a write should use the transaction the write runs in, `cabana.TxFromContext(ctx)`, rather than the application pool: it then sees the write's own snapshot and takes no second connection while the transaction holds row locks. The handle is valid only until the hook returns, and the list route, which runs no transaction, reports none.
|
||||
|
||||
Scope reads and writes with `pact.ListExtendQuery` and `pact.FormExtendQuery` rather than checking in a hook: the scope then applies to every route, including relation and action routes.
|
||||
|
||||
## Toolbar actions
|
||||
|
||||
Reference in New Issue
Block a user