dspace-angular
dspace-angular copied to clipboard
Cannot add new relationships between Entities
Describe the bug When adding a new relationship between entities, it's not possible to save the results. The page hangs and the new relationship is never saved.
To Reproduce Steps to reproduce the behavior:
- Edit a publication, going to the "Relationships" tab
- Click "+Add" next to Authors and attempt to add a new Author
- Select a local author who is already in the system.
- Click "Save".
- Behind the popup, you'll see the author has appeared. But the popup never closes. It hangs.
- Click away from the popup and it will finally close. It looks like the Author may be added.
- Now reload the page in your browser. The new Author disappears. It was not added.
NOTE: If you try the same process but attempt to import a new Author from an external source, the imported Person Entity will be created. However, it will not be linked to your Publication.
Expected behavior Obviously this should work like in 7.x.
I retested this issue in the sandbox and found, that if you hit save on the itempage as well, it works for me. I did the following:
- Edit a publication, going to the "Relationships" tab
- Click "+Add" next to Authors and attempt to add a new Author
- Select a local author who is already in the system.
- Click "Save".
- Now, the popup hangs for me as well
- So, click elsewhere on the page (the popup will close)
- Click save on the top of the relationship page
- Reload the page -> The related entities are still there.
Still, I see the issue with the hanging popup window, which is not closing itself.
Thanks @Leano1998 for the additional test! I think I realize where I went wrong. I forgot your step 7. I didn't go back and click "Save" at the top of the relationship page. I had assumed the "Save" button on the popup modal was the only button I had to click.
So, this is working. But the behavior of saving a new relationship is slightly confusing & the popup window never closes itself.
I looked a bit into this and think it might be related to this older issue #1371 If I add the following line (which has been removed in this Commit), the window closes for me:
setTimeout( () => {
this.submit.emit();
this.modalRef.close()
},1000);
edit-relationship-list.component.ts (L352)
But I don't fully understand, why it has been removed.
Thanks @Leano1998 for working to track that down. I don't know the answer to your question, but it seems like the code you referenced was removed in #1329 by @atarix83 . This seems to have been over 3 years ago now, so it may be difficult to track down why that change was made.
If you want to simply create a PR to add the fix that works for you, that may be the best approach. That way we can get some additional testers to ensure it also works for them.
Okay, I can create a PR.