-
Notifications
You must be signed in to change notification settings - Fork 359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix record navigation when results are loaded with js #4196
Open
ThoWagen
wants to merge
1
commit into
vufind-org:dev
Choose a base branch
from
ThoWagen:pull-request/fix-result-scroller-with-js-results
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why has the initialization been made unconditional? Isn't this going to cause initialization in contexts where it is supposed to be disabled? And shouldn't we also check for an active result scroller in the AJAX handler?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no obvious way to access the 'resultScrollerActive' method in 'GetSearchResults' because it is configured for each search and record controller.
I figured that always initializing the result scroller does not cause any problems but avoids introducing new complexities. There might be possible applications in the future where the result scroller is used but
Record->next_prev_navigation
is false.But if I'm missing something here I can also try to refactor this so that the decision if the scroller should be initialized is made on the results of the searches instead of a method in the search controller.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @ThoWagen, I think I'm inclined to agree with you, but I'd love to get another opinion (maybe from @EreMaijala, if and when he has time) in case there's something we're overlooking. A couple of related thoughts:
1.) The only potential disadvantage I can see to unconditionally initializing the scroller is that in a system with a mix of different search types, if a user is performing a mix of different search types in multiple tabs/windows, there is a possibility that the result scroller data will get evicted more quickly, since we only store a limited amount in the session. I'm not sure how likely this scenario is (I suspect not very), but it at least seems like a possible problem.
2.) If we don't conditionally initialize the result scroller results, I think we might be able to eliminate the resultScrollerActive method from all of the search controllers, which would nicely reduce redundancy in the code (I've never liked having to override this in two places to make it work right). But maybe that's also a sign that this decision belongs somewhere else, like in the search params object -- if we moved it there, we could potentially make more decisions in the ResultScroller plugin instead of the controllers, and that might be the best of both worlds. But it would also require more refactoring, and some of the edge cases where the behavior is based on factors other than just the search backend might be ugly. I'm not strongly advocating for this much change, but just brainstorming!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding 1.) We could change that, so that the limit is applied separately for each backend.
Regarding 2.) I'm willing to do refactoring here, since that should certainly be an improvement. But let's see if Ere has an opinion on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding 1.) I think if we have a backend-specific limit, it defeats the purpose of a limit since the goal is to prevent excessive session growth, and a system with a lot of different backends could end up with huge sessions. Maybe this could be offset by having a configurable overall limit and configurable backend-specific limits, but that could get ugly and complicated, and would people actually know to configure it correctly?
Regarding 2.) I agree that we should wait and see what Ere thinks. I know he's having a busy month, though, so we shouldn't expect to hear from him right away. Maybe we should plan to talk about this on the next Community Call if it hasn't been addressed by then, just so we don't lose track of it! I'll give this an 11.0 milestone to ensure it ends up on the agenda.