Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Events After saving / updating nodes of type happen before record is written to database

Aperta
#175 7 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
38/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
php
Ambito
backend

Direzione di ricerca

Start by reading node_save(), hook_node_insert(), and hook_node_update(), then compare their transaction timing with the Rules events described in the issue. Trace the node save events and review the linked Drupal issue and current documentation. Done means the event semantics and user-facing labels or behavior are clearly aligned, with coverage for the resulting expectation.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

The UI for rules events is misleading.

image

There are several possible events that say "after" but the actions happen before. I confirmed this using Rules Throttle which I ported so I could check in a view whether the change had happened.

It is very misleading as there is also an event that says "before saving content". If all the "after" events actually take place before the save, what does the "before" event do?

I've come across this on nodes, but I think this could apply across the board on other entities. I couldn't find anything on our issue queue but checked on Drupal and found this:
https://www.drupal.org/project/rules/issues/2877239

I then looked up our docs which both say:

Note that when this hook is invoked, the changes have not yet been written to the database, because a database transaction is still in progress. The transaction is not finalized until the save operation is entirely completed and node_save() goes out of scope. You should not rely on data in the database at this time as it is not updated yet. You should also note that any write/update database queries executed from this hook are also not committed immediately. Check node_save() and db_transaction() for more info.

https://docs.backdropcms.org/api/backdrop/core%21modules%21node%21node.api.php/function/hook_node_insert/1
https://docs.backdropcms.org/api/backdrop/core%21modules%21node%21node.api.php/function/hook_node_update/1

I have two questions:

  1. Is there any way in rules to do actions after the save event?
  2. Should we be looking to improve the UX here so that user expectations are managed?
Lingua principale
PHP
Stelle
5
Fork
10
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di backdrop-contrib/rules

Tutte le issue di backdrop-contrib/rules

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.