GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — fix(sidebar): misleading thread timestamp by jeheskielsunloy · Pull Request #1030 · pingdotgg/t3code Conversation
|
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip CodeRabbit can use OpenGrep to find security vulnerabilities and bugs across 17+ programming languages.OpenGrep is compatible with Semgrep configurations. Add an |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Updates sidebar thread ordering and display timestamps to use the first message's createdAt instead of the thread container's createdAt, better reflecting when the conversation actually started.
Changes:
getThreadSidebarTimestamp helper that finds the earliest message timestamp (falling back to thread.createdAt for empty threads)💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| function getThreadSidebarTimestamp(thread: Thread): string { | ||
| if (thread.messages.length === 0) { | ||
| return thread.createdAt; | ||
| } | ||
|
|
||
| let earliestTimestamp = thread.messages[0]?.createdAt ?? thread.createdAt; | ||
| let earliestTime = new Date(earliestTimestamp).getTime(); | ||
|
|
||
| for (const message of thread.messages) { | ||
| const messageTime = new Date(message.createdAt).getTime(); | ||
| if (messageTime < earliestTime) { | ||
| earliestTimestamp = message.createdAt; | ||
| earliestTime = messageTime; | ||
| } | ||
| } | ||
|
|
||
| return earliestTimestamp; | ||
| } |
| if (thread.messages.length === 0) { | ||
| return thread.createdAt; | ||
| } | ||
|
|
||
| let earliestTimestamp = thread.messages[0]?.createdAt ?? thread.createdAt; | ||
| let earliestTime = new Date(earliestTimestamp).getTime(); | ||
|
|
||
| for (const message of thread.messages) { | ||
| const messageTime = new Date(message.createdAt).getTime(); | ||
| if (messageTime < earliestTime) { | ||
| earliestTimestamp = message.createdAt; | ||
| earliestTime = messageTime; | ||
| } | ||
| } | ||
|
|
||
| return earliestTimestamp; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Here are some automated review suggestions for this pull request.
Reviewed commit: 0b0dae3ade
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| new Date(getThreadSidebarTimestamp(b)).getTime() - | ||
| new Date(getThreadSidebarTimestamp(a)).getTime(); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Precompute sidebar timestamps before sorting threads
The new comparator recomputes getThreadSidebarTimestamp for both operands on every comparison, and getThreadSidebarTimestamp scans the full thread.messages array each time. In projectThreads sorting this turns one render into roughly O(threadCount * log(threadCount) * messagesPerThread), which is a significant regression for projects with long histories and can make sidebar interactions noticeably sluggish under load; deriving each thread timestamp once before sorting avoids this repeated full scan.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
🟢 Low
Issue on line in apps/web/src/components/Sidebar.tsx:107:
getThreadSidebarTimestamp returns the earliest message timestamp, but the sidebar sorting logic expects the latest timestamp so that more recent activity appears first. This causes threads to sort incorrectly — for example, a thread with messages at [10:01, 10:05] returns 10:01 and appears older than a thread with a single message at 10:03. Change the comparison to find the maximum timestamp instead.
In file apps/web/src/components/Sidebar.tsx around line 107:
`getThreadSidebarTimestamp` returns the **earliest** message timestamp, but the sidebar sorting logic expects the **latest** timestamp so that more recent activity appears first. This causes threads to sort incorrectly — for example, a thread with messages at [10:01, 10:05] returns 10:01 and appears older than a thread with a single message at 10:03. Change the comparison to find the maximum timestamp instead.
Evidence trail:
apps/web/src/components/Sidebar.tsx lines 107-122: `getThreadSidebarTimestamp` function uses `messageTime < earliestTime` comparison to find minimum timestamp. apps/web/src/components/Sidebar.tsx lines 405-413: sorting uses `getThreadSidebarTimestamp(b) - getThreadSidebarTimestamp(a)` (descending order) and variable is named `latestThread`. apps/web/src/components/Sidebar.tsx lines 1317-1325: same sorting pattern. apps/web/src/components/Sidebar.tsx line 1576: timestamp displayed as relative time ('Xm ago') implying most recent activity.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…-component-15ebfccf0b pingdotgg#1030 Locate Kanban Icon Component
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.