Open jlipka opened 1 month ago
If I'm understanding correctly, the core issue here is that that arrow dropdown (to the right of "Person Search Results") should not be displayed when there are no results. Instead, in the example above, if you select "Select Page" it seems it is trying to select the first page of results as if there was no search.
For instance, I see that the "Select Page" option appears to work properly when "Person Search Results" has results to display.
So, I believe this bug may be fixed if the "Select Page" and "Deselect Page" options no longer exist when the page of search results is empty.
Needs a volunteer.
If I'm understanding correctly, the core issue here is that that arrow dropdown (to the right of "Person Search Results") should not be displayed when there are no results.
Yes, I think you're right - your proposed change should solve all the problems described.
Good morning @tdonohue!
I've been looking for a few days and testing possible solutions to this problem and I've come up with a few possibilities:
Put the following conditional with ngIf in the select/deselect dropdown of the page: ngIf="(resultsRD$ | async)?.page.length > 0”
Put a disable property on the button, so that if the search returns no results, the select/deselect options are disabled. This would take advantage of the variable “*ngVar=”(resultsRD$ | async) as resultsRD” : [disabled]=”!resultsRD?.page.length > 0”
Make the “selectPage()” method only run when the page has an item on it:
selectPage(page: SearchResult
I've tested all these different ways and it works, but unfortunately the condition is only reproduced once and then it doesn't work anymore. The tests were carried out on the component: src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/search-tab
I hope this helps in some way, and if you have any suggestions, please let me know.
@Andrea-Guevara : I don't understand what you mean by this..
I've tested all these different ways and it works, but unfortunately the condition is only reproduced once and then it doesn't work anymore.
Are you saying that all the fixes you tried are unsuccessful? Or they only partially work?
I'm not sure what to recommend here as I'm not familiar with this area of the code. But, if the fixes that are attempted only partially work, that means there must be a larger bug here. I'm not sure where it would be offhand, but that may imply that someone would need to dig deeper as to why a basic fix only works temporarily.
Good afternoon @tdonohue, I hope you're well!
I didn't explain myself very well! I meant that my attempts to solve this problem only work once. It seems that some cache is stored and the conditionals are not able to identify the changes. For example:
If I open the modal and it has results the return would be “true” but if no results are present, the return would be “false”. It seems that this switch between true and false isn't identified, so it's almost impossible to condition the dropdown so that it doesn't appear if no results are found.
I hope I've made myself clear haha. If it's still not clear, let me know.
@Andrea-Guevara : Ok, I understand now.
Unfortunately, I'm not sure of the answer myself. It does sound like something is cached here. It may need some digging / debugging to understand what is going on. That's not something I have time for at the moment.
The only alternative is to find a different way to solve this issue. Obviously, the core issue here is that you shouldn't be able to select a page if there are no pages. I'm not sure myself of a better solution at the moment. Hopefully, if another developer has an idea here, they'll chime in on this discussion.
@Andrea-Guevara Thank you for your initial research and solutions. I have taken your suggestions and discussion and submitted a PullRequest proposal. There you can also see the possible solution that an event is still triggered if the result set is empty - I think that was still the problem? I followed your approach to disable the dropdown options if there are no results.
I look forward to your feedback, or possibly a merge if everything is OK.
Describe the bug
There is a bug in DSpace when you are in the submission process and use the lookup to search for an author to create a new relationship. The information displayed in the component is incorrect and does not reflect the current relationship state of the submission item.
My test was made locally with DSpace in version 8, the same error occurs in the sandbox (sandbox.dspace.org) with Version 9.
To reproduce
Now there are several problems to the user:
Expected behavior
Screenshots