Skip to content

Add feature to Group starred Items per Feed #3148

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

Open
wants to merge 30 commits into
base: master
Choose a base branch
from

Conversation

Juri-w
Copy link

@Juri-w Juri-w commented Apr 20, 2025

Summary

Add Ability to Group Starred Items per Feed. Grouped Feeds are visible under the collapse of starred items. Per Grouped Feed a count of Starred Items is listed.

Checklist

Copy link
Collaborator

@wofferl wofferl left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution.

Please take a look at the suggested changes and fix the linter errors that npm run lint shows.
A changelog entry should also be added.

@wofferl wofferl added enhancement frontend impact Javascript/Frontend code labels Apr 21, 2025
Juri-w added 5 commits April 21, 2025 15:43
Signed-off-by: Juri-w <[email protected]>
Signed-off-by: Juri-w <[email protected]>
Signed-off-by: Juri-w <[email protected]>
Signed-off-by: Juri-w <[email protected]>
@Juri-w Juri-w requested a review from wofferl April 21, 2025 16:41
Copy link
Collaborator

@wofferl wofferl left a comment

Choose a reason for hiding this comment

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

I still see minor problems with the feature.

As I already mentioned, the feed counters are initially not correct and only show the starred items that have already been loaded. With a larger number of starred items, these counters are than counted up while you are going through these feeds.

For the existing routes, the counters are synchronised with the database and are therefore correct from the start, so I don't think this would actual possible for the starred feeds without changes to the backend.

Another problem is that the scroll position is currently not reset, when switching between starred feeds, which is due to the fact that it is not a real route and does not have its own fetchKey.

The open status also cannot be saved, because it is not a real folder.

I think we can live with the latter, I'm not sure whether it would be better to omit the counters, but the scroll reset would be necessary.

@Grotax @SMillerDev your opinions on this?

@Juri-w
Copy link
Author

Juri-w commented Apr 21, 2025

For the existing routes, the counters are synchronised with the database and are therefore correct from the start, so I don't think this would actual possible for the starred feeds without changes to the backend.

The number of starred items is loaded as soon as the view opens; once retrieved, they’re grouped by the starred‑item collection from the store, so they display correctly immediately. Feed icons and names load afterward, which means the starred list initially appears without icons or titles until the Feeds data is fully loaded.

I’ve also fixed the scroll‑reset issue.

@Juri-w Juri-w requested a review from wofferl April 21, 2025 23:27
@wofferl
Copy link
Collaborator

wofferl commented Apr 22, 2025

For the existing routes, the counters are synchronised with the database and are therefore correct from the start, so I don't think this would actual possible for the starred feeds without changes to the backend.

The number of starred items is loaded as soon as the view opens; once retrieved, they’re grouped by the starred‑item collection from the store, so they display correctly immediately. Feed icons and names load afterward, which means the starred list initially appears without icons or titles until the Feeds data is fully loaded.

I’ve also fixed the scroll‑reset issue.

Bildschirmaufnahme_20250422_160104.webm

This clip demonstrates the problem. As you can see, there are a total of 142 starred articles, if you now open the starred feeds, you will see three feeds which, according to the counters, contain exactly 40 articles together. These are the 40 articles that are initially retrieved from the database by default, sorted by date. When you open the first feed and select the only article loaded, 40 more articles are requested from the database, again sorted by date regardless of the feed. Now older articles from the Arch Linux feed also appear. However, since this feed only has a lot of older articles, nothing happens here despite forced triggering of the scroll event using the mouse wheel, because the next batch of articles 81-120 does not contain any of these articles.

I think this clearly shows the problem with this feature. A ‘filter’ feature can actually only work if you make specific requests to the database/backend. Pure filtering in the frontend is not possible.

@Grotax
Copy link
Member

Grotax commented Apr 22, 2025

I agree with @wofferl.

@Juri-w
Copy link
Author

Juri-w commented Apr 28, 2025

I have changed it now on the backend, the starredFeed Counter is retrieved with the feeds and the stared items are fetched with the feed id, which returns only the starred items for the selected feed.

Btw. Thank you for constructive the feedback. I clearly hadn't tested it in the full extend before.

@Juri-w Juri-w requested a review from wofferl April 28, 2025 00:20
Copy link
Collaborator

@wofferl wofferl left a comment

Choose a reason for hiding this comment

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

Actual not working:

  • Starred feed routes don't fetch more items (see comment src/store/item.ts)
  • Starred feed counter don't update on change.
  • In some cases not all items are shown after reload app or press 'r' to refresh

So take al look at the suggestions and as I suggested I would prefer using the existing starred route to decrease complexity.

You also will take a closer look at the unit tests (frontend: make js-test, backend: make unit-test), it is always good idea to check changes with make test and npm run lint
Keep in mind that the api is also used by other clients.

@wofferl wofferl added the API Impact API/Backend code label May 2, 2025
Juri-w added 2 commits May 3, 2025 12:44
Signed-off-by: Juri-w <[email protected]>
Signed-off-by: Juri-w <[email protected]>
Juri-w added 10 commits May 3, 2025 13:19
Signed-off-by: Juri-w <[email protected]>
Signed-off-by: Juri-w <[email protected]>
Signed-off-by: Juri-w <[email protected]>
Signed-off-by: Juri-w <[email protected]>
Signed-off-by: Juri-w <[email protected]>
@Juri-w
Copy link
Author

Juri-w commented May 5, 2025

I've added the counter and the fetching works according to my tests properly as well. I couldn't recreate the problem with the refresh with 'r', but it could be that I solved it during solving the other problems.
I ran all JS (Unit-)Test, but couldn't get the make unit-test and make test to get running, because the bootstrap.php trys to use a bootstrap file three folders above require_once __DIR__ . '/../../../tests/bootstrap.php'; where logicly none exists. Maybe I'm missing something.

@Juri-w Juri-w requested a review from wofferl May 5, 2025 18:55
@wofferl
Copy link
Collaborator

wofferl commented May 6, 2025

I've added the counter and the fetching works according to my tests properly as well. I couldn't recreate the problem with the refresh with 'r', but it could be that I solved it during solving the other problems. I ran all JS (Unit-)Test, but couldn't get the make unit-test and make test to get running, because the bootstrap.php trys to use a bootstrap file three folders above require_once __DIR__ . '/../../../tests/bootstrap.php'; where logicly none exists. Maybe I'm missing something.

You need the test folder from the nextcloud/server repository which contains the bootstrap.php.

Now you have set :exact="true" you don't need the extra starredfeed route and all the checks when to use starred and when to use starredfeed. I have attached a patch how I would implement this, to have a consistent feedKey for starred through the app.
I would also not loading the lastViewedFeedId for the last starred feed, as long the open state for starred is not saved.

starred-route.patch.txt

Also the header in the item list for starred feeds don't show the feed name and the counter is not in sync.

You should then also consider squashing the commits, so that we have a clean commit history.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Impact API/Backend code enhancement frontend impact Javascript/Frontend code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants