Avoid unnecessary entity saves & invalidations

Created on 23 December 2023, 12 months ago

Problem/Motivation

When saving a node using the menu link module and this as a widget, the sibling menu items are re-saved every time. Even if the weight of those items didn't change. This causes unnecessary cache invalidation, hook invocations and time.

Steps to reproduce

  1. Implement the module as describe on a node.
  2. Create a 'hook_node_update' function that contains some logging of the node id.
  3. create various menu items.
  4. re-save a node that is sibling to those menu items
  5. Observer your logging from the hook that the pages unnecessarily get re-saved.

Proposed resolution

Check if the menu item already has the weight from the form. If the weights match, skip it.

Remaining tasks

Patch

User interface changes

None

API changes

None

Data model changes

None

πŸ› Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States pookmish

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024