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

Items read on other devices do not disappear on pressing 'r' #2948

Closed
3 tasks done
etam opened this issue Nov 29, 2024 · 9 comments · Fixed by #2981
Closed
3 tasks done

Items read on other devices do not disappear on pressing 'r' #2948

etam opened this issue Nov 29, 2024 · 9 comments · Fixed by #2981
Labels
bug frontend impact Javascript/Frontend code

Comments

@etam
Copy link

etam commented Nov 29, 2024

IMPORTANT

  • I have read the CONTRIBUTING.md and followed the provided tips
  • I accept that the issue will be closed without comment if I do not check here
  • I accept that the issue will be closed without comment if I do not fill out all items in the issue template.

Explain the Problem

It's explained below.

Steps to Reproduce

  1. Open the news in the browser.
  2. On an android phone read some articles using the app and refresh to make sure the state is synchronized.
  3. In the browser press 'r' to refresh. The articles read on the phone still appears as unread.
  4. Hit ctrl+r to see them as read.

System Information

  • News app version: 25.0.3
  • Nextcloud version: 30.0.2
  • Cron type: system cron
  • PHP version: 8.2.25
  • Database and version: MariaDB 11.5.2
  • Browser and version: Firefox 132.0.2
  • OS and version: Server or client? Server: openSUSE Leap 15.6. Nextcloud runs in docker.
@etam etam added the bug label Nov 29, 2024
@Grotax Grotax added the frontend impact Javascript/Frontend code label Nov 29, 2024
@lgabardos
Copy link
Contributor

Found something interesting on this... It happens only when the list is sorted by oldest first... Removing the list sort, then the refresh correctly fetch data

async refreshFeedList() {
// with ordering newest>oldest complete refresh of item list needed
if (!this.listOrdering) {
this.$store.dispatch(ACTIONS.RESET_LAST_ITEM_LOADED)
this.$refs.virtualScroll.scrollTop = 0
// make sure the first items from this ordering are loaded
this.fetchMore()
this.cache = undefined
this.refreshItemList()
}
// sync feed counter with backend
await this.$store.dispatch(ACTIONS.FETCH_FEEDS)
},

@wofferl
Copy link
Collaborator

wofferl commented Dec 12, 2024

Found something interesting on this... It happens only when the list is sorted by oldest first... Removing the list sort, then the refresh correctly fetch data

Yes, that is how I have currently implemented it so that a refresh only updates the feed counters and otherwise only refreshes the view of the list and only in the case of sorting from new to old is the list cleared and the lastitemloaded counter reset.

Doing this for the other sorting as well will probably not solve the problem completely, because you would have to implement a complete reload and forget everything you have loaded so far to get the items in sync.

@lgabardos
Copy link
Contributor

Found something interesting on this... It happens only when the list is sorted by oldest first... Removing the list sort, then the refresh correctly fetch data

Yes, that is how I have currently implemented it so that a refresh only updates the feed counters and otherwise only refreshes the view of the list and only in the case of sorting from new to old is the list cleared and the lastitemloaded counter reset.

Doing this for the other sorting as well will probably not solve the problem completely, because you would have to implement a complete reload and forget everything you have loaded so far to get the items in sync.

May be not removing the "if" but in a "else" calling the fetchMore might solve this?

@wofferl
Copy link
Collaborator

wofferl commented Dec 12, 2024

Found something interesting on this... It happens only when the list is sorted by oldest first... Removing the list sort, then the refresh correctly fetch data

Yes, that is how I have currently implemented it so that a refresh only updates the feed counters and otherwise only refreshes the view of the list and only in the case of sorting from new to old is the list cleared and the lastitemloaded counter reset.
Doing this for the other sorting as well will probably not solve the problem completely, because you would have to implement a complete reload and forget everything you have loaded so far to get the items in sync.

May be not removing the "if" but in a "else" calling the fetchMore might solve this?

A fetchMore only loads a new batch of 40 items beginning from lastitemloaded or 0 if the counter is reset. If you have already loaded more items in your session these will probably not reloaded and therefore keep the unread state.

To fix this a complete state reset is necessary.

@lgabardos
Copy link
Contributor

Right ok... So may be removing the if statement then...?

I'm happy to investigate if it can be a solution here

@etam
Copy link
Author

etam commented Dec 12, 2024

Found something interesting on this... It happens only when the list is sorted by oldest first

But I don't have oldest first enabled and I have this problem.

In the browser console I have GET https://<my_server>/apps/news/items?limit=40&oldestFirst=false&search=&showAll=true&type=6 and the response has only the unread items that should stay, but what is displayed is unchanged.

@wofferl
Copy link
Collaborator

wofferl commented Dec 12, 2024

Right ok... So may be removing the if statement then...?

I'm happy to investigate if it can be a solution here

You can test this with both sorting directions if you want, but as I said to fix this right I think you need to clear all items from the item store and reset the counters, which is almost like reloading the app.

@lgabardos
Copy link
Contributor

Right ok... So may be removing the if statement then...?
I'm happy to investigate if it can be a solution here

You can test this with both sorting directions if you want, but as I said to fix this right I think you need to clear all items from the item store and reset the counters, which is almost like reloading the app.

which is basically done by the "if (!this.listOrdering) { " on line 220, no?

@lgabardos
Copy link
Contributor

Found something interesting on this... It happens only when the list is sorted by oldest first

But I don't have oldest first enabled and I have this problem.

In the browser console I have GET https://<my_server>/apps/news/items?limit=40&oldestFirst=false&search=&showAll=true&type=6 and the response has only the unread items that should stay, but what is displayed is unchanged.

Yeah that's the issue, the items are cached and not clearer when receiving updates

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

Successfully merging a pull request may close this issue.

4 participants