D3 graph displays wrong number filtering by language in entity_mesh module

Created on 23 April 2025, 25 days ago

Problem/Motivation

When using the entity_mesh module's D3 graph visualization and filtering the view by a specific language (e.g., "es"), the graph incorrectly displays all translations of referenced nodes rather than only those in the selected language.

For example, if Node 2 and Node 3 both reference Node 1, and Node 1 has translations in both "es" and "en", the graph will display four links (one for each translation), instead of only showing the links relevant to the filtered language. This results in misleading visualizations, where the number of child nodes and links is inflated, making it difficult for users to understand the true entity relationships for the selected language.

Steps to reproduce

  1. Enable the entity_mesh module and configure the D3 graph visualization for an entity type (e.g., nodes).
  2. Create Node 1 with translations in both "es" (Spanish) and "en" (English).
  3. Create Node 2 and Node 3, both referencing Node 1.
  4. Filter the view to display only the "es" language.
  5. Observe the D3 graph: Node 1 is shown with two children (Node 2 and Node 3) but with four links—one for each translation—instead of only two links corresponding to the selected language ("es").

Proposed resolution

Update the logic generating the D3 graph to ensure that only entity references matching the selected language filter are included in the graph data.

When a language filter is applied (e.g., "es"), only show nodes and links corresponding to entities in that language. Translations that do not match the filter should be excluded from the visualization.

Also test to disable the ajax on the view to check if it is related.

Remaining tasks

  • Update the D3 graph data generation logic to respect the active language filter.
  • Test the graph with multilingual entities and multiple language filters to confirm the correct number of nodes and links are shown.
  • Document the fix and add/update test coverage if applicable.

User interface changes

The D3 graph visualization will correctly display only nodes and links for the selected language, resulting in more accurate relationship diagrams for multilingual content.

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇪🇸Spain eduardo morales alberti Spain, 🇪🇺

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

Comments & Activities

Production build 0.71.5 2024