Skip to content

Commit

Permalink
fix(split links): use correct ref on non-release pages
Browse files Browse the repository at this point in the history
PR #512 fixed it for the release editor, but broke it for artists
etc. Turns out the MBS change there only applied to the release
editor, the other pages weren't affected by the new property.
  • Loading branch information
ROpdebee committed Aug 13, 2022
1 parent c085017 commit 5bc1be2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/lib/MB/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ declare global {
MB: {
releaseEditor?: ReleaseEditor;
sourceExternalLinksEditor?: {
externalLinksEditorRef: {
current: ExternalLinks;
};
current: ExternalLinks;
};
};
}
Expand Down
2 changes: 1 addition & 1 deletion src/mb_multi_external_links/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { onAddEntityDialogLoaded, qsa, qsMaybe, setInputValue } from '@lib/util/

function getExternalLinksEditor(mbInstance: typeof window.MB): ExternalLinks {
// Can be found in the MB object, but exact property depends on actual page.
const editor = (mbInstance.releaseEditor?.externalLinks ?? mbInstance.sourceExternalLinksEditor)?.externalLinksEditorRef.current;
const editor = (mbInstance.releaseEditor?.externalLinks.externalLinksEditorRef ?? mbInstance.sourceExternalLinksEditor)?.current;
assertHasValue(editor, 'Cannot find external links editor object');
return editor;
}
Expand Down

0 comments on commit 5bc1be2

Please sign in to comment.