-
Notifications
You must be signed in to change notification settings - Fork 7
Fix Incorrect Asset Date When Viewing Restored Data Offline #3338
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: numbers-official <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes an issue with incorrect asset date display in offline mode by replacing the unreliable string length check with a threshold-based approach in the timestamp getter within the Proof class.
- Replaces a string-length check with numerical threshold logic.
- Updates inline documentation and changelog to reflect the new approach.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
src/app/shared/repositories/proof/proof.ts | Updates the logic in the timestamp getter to use a threshold-based approach and revises documentation comments. |
CHANGELOG.md | Adds an entry referencing the fix for incorrect asset date display (fixes #3336). |
@@ -61,11 +61,12 @@ export class Proof { | |||
*/ | |||
get uploadedAtOrTimestamp() { | |||
const MILLISECONDS_PER_SECOND = 1000; | |||
const LENGTH_IN_MILLISECONDS = 13; | |||
const MILLISECONDS_THRESHOLD = 10000000000; // 10^10, timestamps after March 2001 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this threshold logic is or may be reused elsewhere, consider extracting MILLISECONDS_THRESHOLD into a shared constants file for improved maintainability.
Copilot uses AI. Check for mistakes.
This PR doesn’t address the root issue and should be revised. |
…getter Co-authored-by: olgahaha <[email protected]>
I've revised the PR to address the root issue. The previous approach only fixed the timestamp conversion in the The new solution modifies the Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Problem
When the app is in offline mode and users view restored assets, the displayed dates are incorrect. This issue only occurs in offline mode and creates confusion for users who need accurate timestamps.
Root Cause
The
uploadedAtOrTimestamp
getter in the Proof class was using string length to determine if a timestamp was in milliseconds or seconds format:This approach is unreliable when handling timestamps from restored data, especially when offline.
Solution
Implemented a more robust threshold-based approach to detect if a timestamp is in milliseconds or seconds:
This approach is more reliable because:
Changes
uploadedAtOrTimestamp
getterFixes #3336.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
npm.pqina.nl
npm install
(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.