Skip to content
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

Make a single IPC call for the navigation history #6366

Merged
merged 2 commits into from
Dec 20, 2024

Conversation

absidue
Copy link
Member

@absidue absidue commented Dec 12, 2024

Make a single IPC call for the navigation history

Pull Request Type

  • Performance improvement

Related issue

Description

The current implemenation of the navigation history dropdowns makes a lot of IPC calls, one to get the active index, a second one to get the total number of history entries and then one IPC call for each history entry that it wants to get the title for. This pull request moves the construction of that navigation history list into the main process, that way we just need a single IPC call that can directly return the list, avoiding all of the overhead from the extra IPC calls.

While I was at it, I also replaced the IPC call to navigate to a history offset with router.go(offset) as it does the same thing without needing to do the IPC call.

Testing

Right click on the navigation arrows and navigate to various history entries, it should behave the same as before.

Desktop

  • OS: Windows
  • OS Version: 10
  • FreeTube version: c686b84

@github-actions github-actions bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label Dec 12, 2024
@FreeTubeBot FreeTubeBot enabled auto-merge (squash) December 12, 2024 23:20
Copy link
Collaborator

@kommunarr kommunarr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! Thank you for doing this!

issue (minor): I am seeing a new bug that I can confirm I do not see in development: when making two consecutive page searches, the title displayed in the dropdown for the active entry is now incorrectly the title for the previous search, not the current one.

Screenshot_20241212_174245

@absidue
Copy link
Member Author

absidue commented Dec 14, 2024

Okay this is an interesting one, as I can't spot any changes to the logic, I think it is actually a pre-exiting race-condition. Both the title setting code and the fetching the menu are async and I think by messing with one of them, I've changed the order in which they finish, changing the outcome.

I'll try experimenting a bit with the title setting code, e.g. at the moment we call a store action that is just a thin wrapper around a store mutation, so if we directly call the mutation which is sync, instead of the action which is asnyc it might fix it.

@absidue
Copy link
Member Author

absidue commented Dec 15, 2024

Fixed the issue.

@efb4f5ff-1298-471a-8973-3d47447115dc

Im unsure if this is caused by the PR but will mention it anyway. The history will list the previous page for a split second when navigating to a route that has to load stuff e.g. watch page

VirtualBoxVM_zdoBFIpFdv.mp4

@absidue
Copy link
Member Author

absidue commented Dec 17, 2024

I would say that that is expected behaviour as we don't know the video title until we have loaded the data, so we can't update the window title or the menu description until it has loaded. All we could do to improve the situation would be to add an extra in between title e.g. Watch or Loading... that we would show until we have know the actual video title.

@efb4f5ff-1298-471a-8973-3d47447115dc

Should that be addressed in this PR or a separate one?

@absidue
Copy link
Member Author

absidue commented Dec 19, 2024

I would say introducing a placeholder should happen in a follow up, as the main goal of this PR was to speed it up and there not being anything to show while it is loading is sort of unrelated to that, at least in my mind.

@FreeTubeBot FreeTubeBot merged commit 098f62d into FreeTubeApp:development Dec 20, 2024
5 checks passed
@github-actions github-actions bot removed the PR: waiting for review For PRs that are complete, tested, and ready for review label Dec 20, 2024
@absidue absidue deleted the nav-history-perf branch December 20, 2024 06:41
PikachuEXE added a commit to PikachuEXE/FreeTube that referenced this pull request Dec 21, 2024
* development: (57 commits)
  Translated using Weblate (Ukrainian)
  Translated using Weblate (Serbian)
  Translated using Weblate (Hungarian)
  Translated using Weblate (Icelandic)
  Translated using Weblate (Estonian)
  Translated using Weblate (Czech)
  Translated using Weblate (French)
  add missing release builds (FreeTubeApp#6415)
  Translated using Weblate (Serbian)
  Translated using Weblate (German)
  Translated using Weblate (Italian)
  Translated using Weblate (Chinese (Traditional Han script))
  apply overflow menu text color change only to overflow menu (not to stats button) (FreeTubeApp#6406)
  Make a single IPC call for the navigation history (FreeTubeApp#6366)
  Added buttons to hide hidden channels/text (FreeTubeApp#6156)
  Translated using Weblate (Serbian)
  Translated using Weblate (Afrikaans)
  Translated using Weblate (Afrikaans)
  Translated using Weblate (Vietnamese)
  Translated using Weblate (Afrikaans)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants