Skip to content

Conversation

@brianzelip
Copy link
Collaborator

@brianzelip brianzelip commented Dec 4, 2025

This PR fixes an issue where, when viewing a resource's show page in the public interface (e.g., /repositories/4/resources/40), the browser console showed a 404 error:

XHR GET /repositories/4/resources/40/tree/node?node=/repositories/4/resources/40 [HTTP/2 404]

ANW-1831

Problem

The _children_tree partial sets both root_node_uri and current_node_uri to the resource URI. When the tree loads:

  1. setCurrentNode() is called with the resource's tree ID
  2. It finds the root row and marks it as current
  3. It fires node_selected_callback(root_row, tree)
  4. The callback calls tree.expandNode(root_row)
  5. expandNode() calls fetchNode() with the resource URI
  6. The controller builds an invalid backend URL, returning 404

Fix

Add an early return in expandNode() when the row has the root-row class:

Why no new tests are included

The backend behavior is already covered by an existing controller spec, so the console error was expected before this small fix.

@brianzelip brianzelip requested a review from thimios December 4, 2025 03:15
@coveralls
Copy link

Pull Request Test Coverage Report for Build 19916213389

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 27 unchanged lines in 9 files lost coverage.
  • Overall coverage increased (+1.4%) to 80.708%

Files with Coverage Reduction New Missed Lines %
frontend/app/helpers/digital_object_helper.rb 1 87.5%
backend/app/model/accession.rb 1 98.44%
frontend/app/models/edit_mediator.rb 1 91.53%
frontend/app/controllers/application_controller.rb 1 98.3%
backend/app/controllers/job.rb 1 70.59%
indexer/app/lib/realtime_indexer.rb 4 73.53%
frontend/app/controllers/archival_objects_controller.rb 5 87.36%
frontend/app/controllers/agents_controller.rb 6 71.09%
indexer/app/lib/indexer_common.rb 7 98.96%
Totals Coverage Status
Change from base Build 15878865621: 1.4%
Covered Lines: 29005
Relevant Lines: 35938

💛 - Coveralls

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.

3 participants