Skip to content

fix: Sort by "last modified" (issue #5158)#5265

Open
v3DJG6GL wants to merge 20 commits intonextcloud:mainfrom
v3DJG6GL:fix/sort-by-last-modified-5158
Open

fix: Sort by "last modified" (issue #5158)#5265
v3DJG6GL wants to merge 20 commits intonextcloud:mainfrom
v3DJG6GL:fix/sort-by-last-modified-5158

Conversation

@v3DJG6GL
Copy link
Copy Markdown

@v3DJG6GL v3DJG6GL commented Apr 20, 2026

Summary

Fix #5158

With sort order set to Last modified:

  • Switching between groups (e.g. All contactsNot grouped) showed an error:
    Unable to retrieve the contact from the server, please check your network connection.
    
  • After reloading the page, the sort setting was reset to the previous value.
  • This issue was described in Bug: Sort by "last modified" is not working #5158

Underlying issue: sorting crashed whenever any contact had a missing or malformed REV (last-modified) value:
The code called a date method on every contact's REV. If REV was missing or not a valid date, it threw an error.

Changes

  • Read each contact's REV once when contacts are first loaded from the server, and store a plain timestamp (or null if it's missing/unreadable).
  • Contacts with no valid REV sort to the end instead of crashing the list.
  • Tolerate malformed date strings (e.g. wrong format, missing seconds) by parsing them defensively.
  • Make the rev getter return null on error instead of throwing, so one contact with a broken REV can't crash the component that reads it.
  • Stop fabricating REV = now when one is missing (both in the Contact constructor and in a background auto-"fix"). The old behavior made contacts jump to the top every time they were touched.
  • Don't re-sort the whole list when a contact is opened. Its stored REV doesn't change just because it was viewed.
  • Replaced custom scroll math with the list library's built-in scroll-into-view, which prevents visible jumps when the list updates.

LLM Disclosure

Developed with assistance from Claude Code (Opus 4.7, 1M context).
The LLM helped me identify the related files, code parts and proposed possible code modifications and fixes.

I've manually reviewed, the code the best I could.
A proper code review is required in any case...

v3DJG6GL added 20 commits April 20, 2026 20:59
…ast-modified sorting

Signed-off-by: v3DJG6GL <72495210+v3DJG6GL@users.noreply.github.com>
…imitives at storage time

Signed-off-by: v3DJG6GL <72495210+v3DJG6GL@users.noreply.github.com>
Signed-off-by: v3DJG6GL <72495210+v3DJG6GL@users.noreply.github.com>
Signed-off-by: v3DJG6GL <72495210+v3DJG6GL@users.noreply.github.com>
Signed-off-by: v3DJG6GL <72495210+v3DJG6GL@users.noreply.github.com>
…change detection

Signed-off-by: v3DJG6GL <72495210+v3DJG6GL@users.noreply.github.com>
…ore primitives

Signed-off-by: v3DJG6GL <72495210+v3DJG6GL@users.noreply.github.com>
…o prevent fake timestamps

Signed-off-by: v3DJG6GL <72495210+v3DJG6GL@users.noreply.github.com>
…q, curly braces)

Signed-off-by: v3DJG6GL <72495210+v3DJG6GL@users.noreply.github.com>
…le malformed dates

Signed-off-by: v3DJG6GL <72495210+v3DJG6GL@users.noreply.github.com>
…ed dates

Signed-off-by: v3DJG6GL <72495210+v3DJG6GL@users.noreply.github.com>
…rmalization

Signed-off-by: v3DJG6GL <72495210+v3DJG6GL@users.noreply.github.com>
Signed-off-by: v3DJG6GL <72495210+v3DJG6GL@users.noreply.github.com>
Signed-off-by: v3DJG6GL <72495210+v3DJG6GL@users.noreply.github.com>
Signed-off-by: v3DJG6GL <72495210+v3DJG6GL@users.noreply.github.com>
Signed-off-by: v3DJG6GL <72495210+v3DJG6GL@users.noreply.github.com>
Signed-off-by: v3DJG6GL <72495210+v3DJG6GL@users.noreply.github.com>
…act, skipSort?}

Signed-off-by: v3DJG6GL <72495210+v3DJG6GL@users.noreply.github.com>
Signed-off-by: v3DJG6GL <72495210+v3DJG6GL@users.noreply.github.com>
Signed-off-by: v3DJG6GL <72495210+v3DJG6GL@users.noreply.github.com>
@v3DJG6GL v3DJG6GL force-pushed the fix/sort-by-last-modified-5158 branch from e72a0aa to 1e5e15c Compare April 20, 2026 19:00
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 20, 2026

Codecov Report

❌ Patch coverage is 0% with 57 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/store/contacts.js 0.00% 23 Missing and 12 partials ⚠️
src/models/contact.js 0.00% 16 Missing and 6 partials ⚠️

📢 Thoughts on this report? Let us know!

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.

Bug: Sort by "last modified" is not working

1 participant