Skip to content

Commit

Permalink
MBS-12737: Properly check backwardness with isRelationshipBackward (#…
Browse files Browse the repository at this point in the history
…2796)

The overconfident check we had was hitting issues for recordings
creating during the NGS migration which had the same rowid
as the associated works.
We have a perfectly working isRelationshipBackward check, so this
just changes the code to use it.
  • Loading branch information
reosarevok authored Jan 6, 2023
1 parent 5b00013 commit 43fc0b9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import type {
import getLinkPhrase from '../utility/getLinkPhrase.js';
import getRelationshipKey from '../utility/getRelationshipKey.js';
import getRelationshipLinkType from '../utility/getRelationshipLinkType.js';
import isRelationshipBackward from '../utility/isRelationshipBackward.js';

import NewWorkLink from './NewWorkLink.js';

Expand All @@ -66,7 +67,7 @@ const RelationshipItem = (React.memo<PropsT>(({
source,
track,
}: PropsT): React.MixedElement => {
const backward = relationship.entity1.id === source.id;
const backward = isRelationshipBackward(relationship, source);
const target: CoreEntityT = backward
? relationship.entity0
: relationship.entity1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
findTargetTypeGroups,
iterateRelationshipsInTargetTypeGroups,
} from '../utility/findState.js';
import isRelationshipBackward from '../utility/isRelationshipBackward.js';

function pushRelationshipHiddenInputs(
formName: string,
Expand All @@ -46,7 +47,7 @@ function pushRelationshipHiddenInputs(
pushInput(relPrefix, 'removed', '1');
}

const backward = relationship.entity1.id === source.id;
const backward = isRelationshipBackward(relationship, source);
const target = backward ? relationship.entity0 : relationship.entity1;

if (target.gid) {
Expand Down

0 comments on commit 43fc0b9

Please sign in to comment.