Prevent Unnecessary Redirects in Domain Source Submodule When Active Domain Matches Domain Source

Created on 5 March 2025, about 1 month ago

Problem/Motivation

The current implementation of the Domain Source submodule always forces a redirect in domain_source_form_submit(), even when the active domain matches the entity’s Domain Source.

This causes unnecessary redirections and may lead to unexpected behavior when saving or editing entities.

Steps to reproduce

  1. Enable the Domain module and Domain Source submodule.
  2. Set up two domains (e.g., domain_a.com and domain_b.com).
  3. Assign an entity (e.g., a node) to Domain A.
  4. Log in to Domain A and edit/save the entity.
  5. Expected behavior: No redirection occurs because the entity already belongs to Domain A.
  6. Actual behavior: A forced redirect occurs unnecessarily, even though the active domain matches the entity’s Domain Source.

Proposed resolution

  • Modify domain_source_form_submit() to only set a redirect if the active domain differs from the entity’s Domain Source.
  • Prevent unnecessary redirections when saving an entity on its assigned domain.

Remaining tasks

  • Review and update the logic in domain_source_form_submit().
  • Write and execute tests to confirm the fix prevents unnecessary redirects.
  • Update module documentation if needed.

User interface changes

No UI changes. The improvement affects backend redirection logic.

Introduced terminology

  • Active Domain → The domain currently being accessed by the user.
  • Domain Source → The assigned domain of an entity.

API changes

No API changes required. The update improves existing logic within domain_source_form_submit().

Data model changes

No database schema changes.

Release notes snippet

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇫🇷France xavier.masson Haute-Normandie

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

Comments & Activities

Production build 0.71.5 2024