Repository navigation
fix(contexts): keep the nodes added by an application update in the loaded shape - #3230
Open
rubenvdlinde wants to merge 1 commit into
Open
rubenvdlinde wants to merge 1 commit into
rubenvdlinde wants to merge 1 commit into
Conversation
…oaded shape Updating an application with new tables or views stored the added nodes and start page contents in their JSON shape (nodeType, nodeId, nodeRelId) next to the loaded ones (node_type, node_id, node_rel_id). Ordering the start page then read keys that were not there, which raised an "Undefined array key" warning and left the new contents unordered, and the returned application mixed both shapes. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
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.
Adding a table or view to an application through
PUT /api/2/contexts/{id}logs a PHP warning,Undefined array key "node_type", and the new table doesn't take its place on the start page.Size: 60 lines: 13 code and 47 tests.
What changes
ContextService::update()keeps the nodes and start page contents of the application in two arrays while it works through the submitted list. The loaded ones come fromContextMapperwith snake case keys (node_type,node_id,node_rel_id). Nodes added during the update went in throughjsonSerialize(), which uses camel case (nodeType,nodeId,nodeRelId). Ordering the start page afterwards reads the snake case keys, so for an added node it:Undefined array key "node_type"and"node_id"for the node, and"node_rel_id"for its start page content,nodesandpagesmixed both shapes.Added nodes and contents now go into those arrays in the same shape the mapper loads them in.
How it was tested
New test in
ContextServiceTest: an application with one table gets a view added in front of it. The view comes back in the loaded shape, its start page content gets order 10, and the table moves to 20.🖼️ Screenshots
Backend only, no visual change.
🏁 Checklist
/backport to stableX.X🤖 AI (if applicable)