fix(files_version): mtime confusion on milliseconds#62204
Open
blizzz wants to merge 2 commits into
Open
Conversation
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
c5eee63 to
9049315
Compare
susnux
requested changes
Jul 15, 2026
susnux
left a comment
Contributor
There was a problem hiding this comment.
I think we need to find a better way :/
| versions.value = await fetchVersions(props.node) | ||
| // normalize the node`s mtime first – server does not report milliseconds, they are all 0 | ||
| const normalizedNode = props.node | ||
| normalizedNode.mtime = new Date(Math.floor((props.node?.mtime?.getTime() ?? 0) / 1000) * 1000) |
Contributor
There was a problem hiding this comment.
That still mutates the prop
Member
Author
There was a problem hiding this comment.
Right, i was looking first for a clone method but…
Now i see https://developer.mozilla.org/en-US/docs/Web/API/Window/structuredClone. That OK?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When the Version tab is open and a file is edited, the previews were broken, and so was the download link for the current version. The reason is that the server reports a timestamp on seconds granularity, while JS in the frontend has it on milliseconds level. Zeroing them out solves the issue.
Checklist
3. to review, feature component)stable32)AI (if applicable)