BUGFIX: Do not fail the retranslation status request for untranslated nodes - #106
Open
gradinarufelix wants to merge 2 commits into
Open
gradinarufelix wants to merge 2 commits into
gradinarufelix wants to merge 2 commits into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The retranslate inspector view requests its status for every inspected node.
getTranslationMetadataActionresolves the node in the requested language before it checks whether that language has areferenceLanguageconfigured, and throwsNode not found in workspace and dimension space pointwhen 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
RetranslationController::getTranslationMetadataActionanswers{"isUpToDate": true, "referenceLanguage": null}before resolving the node when the target preset has noreferenceLanguage. 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$sourceLanguageis now always set there.useNodeInforeads 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.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 testpasses (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.jsrebuilt with esbuild 0.25.12; the diff is minifier symbol churn plus the change.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.