FreeTube icon indicating copy to clipboard operation
FreeTube copied to clipboard

Make history page remember last query string & search limit

Open PikachuEXE opened this issue 1 year ago • 36 comments

Pull Request Type

  • [ ] Bugfix
  • [x] Feature Implementation
  • [ ] Documentation
  • [ ] Other

Related issue

Description

Make several page types remember last query string & search limit to deal with

  • Search in history
  • Found a few videos
  • View one of them, go back last page, oops not filtered

Page types:

  • History page
  • Channel tab (Channel List for current profile)
  • User Playlists page
  • Single User Playlist page
  • Single Channel page

Screenshots

No video I am lazy

Testing

  • Ensure last used search query and data limit restored when revisiting history page
  • Ensure they are not restored after clearing query text / in new window
  • Ensure no 2 time rendering on page initial render

Desktop

  • OS:
  • OS Version:
  • FreeTube version:

Additional context

There are 2 commits & first one is refactor Might easier to review per commit

PikachuEXE avatar May 30 '24 06:05 PikachuEXE

I understand where you're are coming from but this behavior is also not apparent in Playlists tab, Channel tab, and a Channel page.

Channel page one also applies to Nr 6 on the list of issue https://github.com/FreeTubeApp/FreeTube/issues/2446 which is a way bigger issue

Just to clarify im not against this but I think we should do it for all pages instead of one for the sake of a consistent UX

I'd also like to know rationale, as I don't see any requests for this. I'm not necessarily opposed to it, but I don't have any reason to believe that the app remembering my last query would cause fewer irksome moments than the app not remembering it.

kommunarr avatar May 31 '24 00:05 kommunarr

Making it work like search query page I realize this when searching in history (and several videos popup), click one of them, not the one I want, go back, oops Though I can always open in new windows (but mobile can't do it?) Up to you guys

PikachuEXE avatar May 31 '24 01:05 PikachuEXE

If you want, you can share the build & I can try it out for a while in personal use. It sounds nice in theory, but it feels more horizontal of a change for the use cases where you want to go to the initial page state & now have to click to clear the input. The search bar is also omnipresent, so you wouldn't ever forget what was going on, but here I could see it leading to momentary confusion and re-familiarizing yourself with the context of what's going on & what you were searching beforehand. Seems like maybe "open in a new tab" covers the type of use case you're mentioning better (albeit I guess not if you didn't expect to misclick).

kommunarr avatar May 31 '24 13:05 kommunarr

Used router.replace to ensure the query text restored only on clicking back Clicking on history link won't restore it

About the catch after replace: https://v3.router.vuejs.org/guide/advanced/navigation-failures.html

Update 1: Use my custom build if you want - https://github.com/PikachuEXE/FreeTube/actions/runs/9345433122

PikachuEXE avatar Jun 03 '24 05:06 PikachuEXE

Just to clarify im not against this but I think we should do it for all pages instead of one for the sake of a consistent UX

Just retested it but my opinion on this hasnt changed.

@efb4f5ff-1298-471a-8973-3d47447115dc Can you list all the page types so I won't miss any on next update?

PikachuEXE avatar Jun 30 '24 22:06 PikachuEXE

That sounds like it would be a pretty sizable change to the codebase for a small feature. I would personally advise putting this one on the backburner just because I'm not sure if the feature would provide enough utility versus the effort to maintain it.

kommunarr avatar Jun 30 '24 22:06 kommunarr

This PR is stale because it has been open 28 days with no activity. Remove stale label or comment or this will be closed in 14 days.

github-actions[bot] avatar Jul 29 '24 01:07 github-actions[bot]

@efb4f5ff-1298-471a-8973-3d47447115dc Can you list all the page types so I won't miss any on next update?

Sure:

  • FT Channel tab
  • User Playlist tab main view
  • Inside User Playlist
  • Creator Channel page

Q: Why does it take a while for the thumbnails to appear when navigating back to the History tab? Why isnt it instantly shown?

https://github.com/user-attachments/assets/ec7489f5-c9eb-4571-82d9-9aad7a674d07

This pull request has conflicts, please resolve those before we can evaluate the pull request.

github-actions[bot] avatar Aug 16 '24 16:08 github-actions[bot]

Q: Why does it take a while for the thumbnails to appear when navigating back to the History tab? Why isnt it instantly shown?

Fixed

PikachuEXE avatar Aug 20 '24 01:08 PikachuEXE

Conflicts have been resolved. A maintainer will review the pull request shortly.

github-actions[bot] avatar Aug 20 '24 01:08 github-actions[bot]

FT Channel tab User Playlist tab main view Inside User Playlist Creator Channel page

Also done but for the Creator Channel page one I am not really confident (even though I tested it a bit

PikachuEXE avatar Aug 20 '24 02:08 PikachuEXE

This pull request has conflicts, please resolve those before we can evaluate the pull request.

github-actions[bot] avatar Sep 20 '24 03:09 github-actions[bot]

Conflicts have been resolved. A maintainer will review the pull request shortly.

github-actions[bot] avatar Sep 21 '24 03:09 github-actions[bot]

Updated

PikachuEXE avatar Oct 01 '24 03:10 PikachuEXE

Notice that results are ordered in a different when navigating back to the channel page

https://github.com/user-attachments/assets/374d566d-037c-4913-9538-e120d69b1d15

I can reproduce it once but cannot reproduce afterward, no idea how results are sorted (or just taking from API)

https://github.com/user-attachments/assets/c57b8fd2-bfee-4f79-a408-b3f32c7ce7b0

PikachuEXE avatar Oct 02 '24 00:10 PikachuEXE

I can reproduce it once but cannot reproduce afterward, no idea how results are sorted (or just taking from API)

If you switch often enough you can make it happen again. It is showing the loading animation so maybe its trying to do something in the background?

Uhh why its focused like that? Dev branch doesnt seem to do that.

https://github.com/user-attachments/assets/a3428fbf-0321-4c0a-b1a4-7e260429b1dc

It is showing the loading animation so maybe its trying to do something in the background?

  • newSearch
  • this.isElementListLoading = true
  • searchChannelLocal or searchChannelInvidious

Ya it's searching

Uhh why its focused like that? Dev branch doesnt seem to do that.

Caused by changeTab -> showOutlines. it's a bug that is never visible until now Fixed

PikachuEXE avatar Oct 03 '24 01:10 PikachuEXE

If you switch often enough you can make it happen again.

I can't make it happen anymore

Maybe you can find the request and look at the result order to see if that matches the order of result displayed?

image image

PikachuEXE avatar Oct 03 '24 01:10 PikachuEXE

I tried to reproduce it again but it took me a solid minute going back and forth to make it happen again. Maybe its not that big of a deal?

If you can prove that the result order is incorrectly/ever manipulated with this PR then it should be fixed Otherwise it could be just temp search result order alternating for who knows why

PikachuEXE avatar Oct 03 '24 12:10 PikachuEXE

If you can prove that the result order is incorrectly/ever manipulated with this PR then it should be fixed

I would love to but im not sure how. Could you give me some more instructions on top of the ones u already provided in https://github.com/FreeTubeApp/FreeTube/pull/5192#issuecomment-2390338307

  • Go into a channel, search stuff
  • Inspect latest request (request payload with query
  • Preview tab, contents...tabs, find element with expandableTabRenderer, content...contents, expand those items to inspect video IDs

PikachuEXE avatar Oct 11 '24 01:10 PikachuEXE

I would like to console log the videoID's because expanding everything like this makes my head hurt. Where should I put the console.log?

Change

        if (isNewSearch) {
          this.searchResults = results
        } else {
          this.searchResults = this.searchResults.concat(results)
        }

to

        if (isNewSearch) {
          this.searchResults = results
          results.forEach(e => {
            if (e.type === 'video') console.log(`${e.type}: ${e.videoId}`)
            else if (e.type === 'playlist') console.log(`${e.type}: ${e.playlistId}`)
            else console.log(`${e.type}`)
          })
        } else {
          this.searchResults = this.searchResults.concat(results)
        }

image

searchChannelLocal is not modified by this PR

PikachuEXE avatar Oct 12 '24 02:10 PikachuEXE

Left one is just a normal search. Right one is when coming back to the channel page

Capture3