Skip to content

Read current ResourceXResource keys in the related resources manager - #13068

Open
rayondemiel wants to merge 1 commit into
archesproject:dev/8.1.xfrom
rayondemiel:fix/related-resources-manager-keys-8.1
Open

rayondemiel wants to merge 1 commit into
archesproject:dev/8.1.xfrom
rayondemiel:fix/related-resources-manager-keys-8.1

Conversation

@rayondemiel

Copy link
Copy Markdown
Contributor

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Description of Change

Since 8.0 the related resources manager cannot list a resource's relationships: parse() fails with Uncaught TypeError: relationship.nodeid is not a function on the first relationship, so neither the list nor the paginator appears. Opening a relationship's panel then fails on relationship.resourceinstanceidfrom(), and saving a relationship leaves the spinner running.

ResourceXResource fields were renamed in 8.0 (#11869: nodeid → node, tileid → tile, resourceinstanceidfrom → from_resource; datestarted/dateended removed) and Resource.get_related_resources serialises them with model_to_dict, so the payload carries the new names. #11986 updated the consumers for to_resource/from_resource, but the manager and its template kept the other old keys.

This PR:

  • keeps the node id under relationship.nodeid (the manager replaces relationship.node with the holder of the node's name and ontology class right after mapping);
  • reads relationship.tile() and relationship.from_resource() in the JS and the template;
  • removes the date fields of the legacy relationship panel, which the server no longer stores (RelatedResourcesView.post reads relationshiptype and notes only);
  • ends the loading state after a successful update (it was only ended after a delete) and on a failed POST.

The payload is unchanged; the other consumers (models/report.js, the related-resources graph, the report API) already read the new keys.

Reproduced and tested on 8.1.5 with a resource holding 1,652 relationships: the list and its 111 pages are shown, the relationship panel opens, a relationship type is saved and the spinner stops.

Investigation and patch prepared with Claude Code (Anthropic); reviewed and tested by the contributor.

Issues Solved

No issue opened.

Checklist

  • I targeted one of these branches:
    • dev/8.2.x (under development): features, bugfixes not covered below
    • dev/8.1.x (main support): regressions, crashing bugs, security issues, major bugs in new features
    • dev/7.6.x (extended support): major security issues, data loss issues
  • I added a changelog in arches/releases
  • I submitted a PR to arches-docs (if appropriate)
  • Unit tests pass locally with my changes
  • I added tests that prove my fix is effective or that my feature works: a Python test pins the tile, node and from_resource keys the manager reads. The failing side is Knockout, which has no unit-test harness in Arches, so the test guards the contract rather than failing on the target branch.
  • My test fails on the target branch

Ticket Background

Further comments

Alternative considered: adding the old names back to the relation dicts in get_related_resources. Rejected: it would reintroduce as duplicates the names 8.0 removed, and #11986 set the precedent of moving the JS to the model field names. The same bug is present on dev/8.2.x.

ResourceXResource renamed nodeid, tileid and resourceinstanceidfrom to
node, tile and from_resource in 8.0 (archesproject#11869) and dropped datestarted and
dateended, but the related resources manager still read the old keys:
parse() threw "nodeid is not a function" on the first relationship, so
no relationship or paginator was shown, and opening a relationship's
panel failed on resourceinstanceidfrom(). Keep the node id under nodeid
before node becomes the name/class holder, read tile() and
from_resource(), and drop the date fields the server no longer stores.
Saving a relationship now also ends the loading state.

Investigation and patch prepared with Claude Code (Anthropic); reviewed
and tested by the contributor.
@rayondemiel
rayondemiel force-pushed the fix/related-resources-manager-keys-8.1 branch from c18168b to 4dad59e Compare October 27, 2026 14:57
@rayondemiel
rayondemiel marked this pull request as ready for review October 27, 2026 20:14
@chiatt
chiatt requested a review from njkim November 2, 2026 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants