Skip to content

BUGFIX: Do not fail the retranslation status request for untranslated nodes - #106

Open
gradinarufelix wants to merge 2 commits into
2.0from
bugfix-retranslation-without-reference-language
Open

gradinarufelix wants to merge 2 commits into
2.0from
bugfix-retranslation-without-reference-language

Conversation

@gradinarufelix

Copy link
Copy Markdown
Collaborator

Problem

The retranslate inspector view requests its status for every inspected node. getTranslationMetadataAction resolves the node in the requested language before it checks whether that language has a referenceLanguage configured, and throws Node not found in workspace and dimension space point when the node has no variant there. Editors reach that state in normal work, so it produces server errors for something that is not an error.

Seen in production on Neos 8.4 with v2.7.0: a page existed in German only. With the Meta tab open, the editor switched the language to English. The Neos UI marks the new dimension as active before it resolves the document, and while the "create variant" dialog is open the inspector still shows the German node. The view therefore asked for that node in English, and react-query's default three retries turned one failure into four server errors.

Changes

  1. RetranslationController::getTranslationMetadataAction answers {"isUpToDate": true, "referenceLanguage": null} before resolving the node when the target preset has no referenceLanguage. Retranslation is opt-in per preset, the payload is byte-identical to the previous answer for that case, and installations that never configure it no longer reach the node lookup. The remaining success path is flattened, because $sourceLanguage is now always set there.
  2. useNodeInfo reads the dimensions from the inspected node's context path instead of the globally active dimension, so the node and the language always belong together. While the dialog is open, the view now shows the status of the node that is actually displayed.
  3. Unit tests for the three paths of the action, and a rebuilt Plugin.js.

The exception for a genuinely missing target node is kept: with the client fix it means an unexpected state, not a normal one.

Verification

  • composer test passes (phpcs PSR12, phpstan level 8, 59 unit tests). Without the first commit, the new test for the preset without a reference language fails with the reported exception.
  • Plugin.js rebuilt with esbuild 0.25.12; the diff is minifier symbol churn plus the change.
  • Not verified in a running backend.

Note on 3.x

The client on 3.3 has the same active-dimension mismatch. There the controller no longer throws, so it shows a wrong status instead of failing. I can send that client change as a separate PR.

The inspector requests the retranslation status for every inspected node. The action
resolved the node in the requested language before it checked whether that language has
a referenceLanguage configured, and threw "Node not found in workspace and dimension
space point" when no variant existed there.

Retranslation is opt-in per language preset, so answer the same payload as before
without resolving the node at all.
The view combined the inspected node with the globally active dimension. When the editor
switches to a dimension the node does not exist in, the Neos UI marks the new dimension
as active before it resolves the document, so node and dimension did not belong together
while the create-variant dialog was open.

Read the dimensions from the node's own context path instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant