Skip to content

Comments

refactor(engine-java): remove unused toJSNode/transformToJsNode methods#643

Open
GauBen wants to merge 2 commits intomainfrom
refactor/dead-jcr-to-json
Open

refactor(engine-java): remove unused toJSNode/transformToJsNode methods#643
GauBen wants to merge 2 commits intomainfrom
refactor/dead-jcr-to-json

Conversation

@GauBen
Copy link
Member

@GauBen GauBen commented Feb 23, 2026

Description

A leftover from the HBS era: we no longer need to manipulate plain JS objects in React, we can use Java objects

Checklist

Source code

  • I've shared and documented any breaking change
  • I've reviewed and updated the jahia-depends

Tests

  • I've provided Unit and/or Integration Tests
  • I've updated the parent issue with required manual validations

Tip

Documentation to guide the reviews: How to do a code review

@GauBen GauBen requested a review from a team as a code owner February 23, 2026 10:06
Copilot AI review requested due to automatic review settings February 23, 2026 10:06
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes legacy code from the Handlebars (HBS) era that was used to convert JCR nodes into plain JavaScript objects. With the migration to React, the codebase now directly uses Java objects, making these transformation methods obsolete.

Changes:

  • Removed three methods from JSNodeMapper that converted JCR nodes to JavaScript objects (toJSNode, toJSNodeProperties, toJSNodePropertyValue)
  • Removed the transformToJsNode method from RenderHelper that wrapped the conversion functionality
  • Updated class documentation to accurately reflect the current purpose of JSNodeMapper (mapping JSON structures to virtual JCR nodes for React's <Render> component)
  • Applied consistent code formatting improvements (line wrapping)

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
javascript-modules-engine-java/src/main/java/org/jahia/modules/javascript/modules/engine/jsengine/JSNodeMapper.java Removed 3 unused methods related to JCR-to-JS conversion, updated documentation, and improved formatting
javascript-modules-engine-java/src/main/java/org/jahia/modules/javascript/modules/engine/js/server/RenderHelper.java Removed unused transformToJsNode method that was a wrapper for the deleted functionality

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@dgriffon dgriffon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!
We need to be sure to remove them in a major version to avoid breaking change though

@GauBen
Copy link
Member Author

GauBen commented Feb 24, 2026

This is not part of the documented API, we can safely remove it as "legacy implementation detail"

We can always revert the deletion in case this assumption is wrong

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.

2 participants