Files
drupal-figli-compta/web
bachir 71fde0f3c0 Add live polling and optimistic locking for concurrent inline edits
Two-part fix so multiple people can edit /lignes at once without
clobbering each other, and see each other's changes without a manual
reload -- no Socket.io/websocket infra, just what fits the existing
fetch-based architecture:

1. Polling (POLL_INTERVAL_MS = 8s): pollForChanges() asks JSON:API for
   any ligne_comptable changed since the last check (filtering on the
   `changed` field -- confirmed live that JSON:API only accepts a raw
   Unix timestamp for this, not the ISO string it returns in responses,
   silently matching everything otherwise) and mergeChangedRows()
   patches matching rows in place via Object.assign (not a `rows`
   reassignment, so it doesn't re-trigger the reconciliation-resolution
   watcher for routine polls). A row currently being edited is skipped
   entirely rather than overwritten out from under an in-progress
   keystroke.

2. Optimistic locking: every row now carries its `changed` timestamp,
   sent back on every inline edit (updateType/updateField). A new
   checkConflict() compares it against the node's actual changed time
   before saving and rejects with 409 if they differ -- someone else
   saved this exact line in between. On a 409, refreshSingleRow()
   re-fetches just that node and patches it in place so the view
   self-corrects instead of staying stuck on the stale state that
   caused the rejection.

Verified live end-to-end against an isolated temporary test node (not
real data): an external edit correctly appeared in the browser within
one poll cycle with no reload; a save using a stale `changed` value was
rejected with the conflict error, confirmed via direct DB query that it
left the node's data completely untouched, and the view auto-corrected
to show the other edit. Test node and its paragraph fully cleaned up
afterward.
2026-09-06 12:49:56 +02:00
..

Drupal Logo

Drupal is an open source content management platform supporting a variety of websites ranging from personal weblogs to large community-driven websites. For more information, visit the Drupal website, Drupal.org, and join the Drupal community.

Contributing

Drupal is developed on Drupal.org, the home of the international Drupal community since 2001!

Drupal.org hosts Drupal's GitLab repository, its issue queue, and its documentation. Before you start working on code, be sure to search the issue queue and create an issue if your aren't able to find an existing issue.

Every issue on Drupal.org automatically creates a new community-accessible fork that you can contribute to. Learn more about the code contribution process on the Issue forks & merge requests page.

Usage

For a brief introduction, see USAGE.txt. You can also find guides, API references, and more by visiting Drupal's documentation page.

You can quickly extend Drupal's core feature set by installing any of its thousands of free and open source modules. With Drupal and its module ecosystem, you can often build most or all of what your project needs before writing a single line of code.

Changelog

Drupal keeps detailed change records. You can search Drupal's changes for a record of every notable breaking change and new feature since 2011.

Security

For a list of security announcements, see the Security advisories page (available as an RSS feed). This page also describes how to subscribe to these announcements via email.

For information about the Drupal security process, or to find out how to report a potential security issue to the Drupal security team, see the Security team page.

Need a helping hand?

Visit the Support page or browse over a thousand Drupal providers offering design, strategy, development, and hosting services.

Know your rights when using Drupal by reading Drupal core's license.

Learn about the Drupal trademark and logo policy here.