Fix(paper): improve saved table layout and track-scoped filtering#367
Conversation
|
@Linjie-top is attempting to deploy a commit to the Jerry's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml 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 for PR comments
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 |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the user experience on the "Saved" page by addressing layout issues and refining core functionalities. It ensures that the saved papers table maintains a clean and readable appearance, even with lengthy titles, and standardizes the "Unsave" operation through a unified feedback API. Crucially, it rectifies a bug in track-scoped filtering, providing users with an accurate view of papers currently saved within each specific track, aligning the system's behavior with user expectations. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Code Review
This pull request introduces valuable improvements to the "Saved Papers" page, enhancing both user experience and backend logic. The frontend changes for table layout and the unification of the unsave action are well-implemented. The backend fix for track-scoped filtering is sound and correctly resolves the described issue. I've included a couple of suggestions for minor refactoring to enhance efficiency and code clarity.
| latest_per_track: Dict[tuple[int, int], str] = {} | ||
|
|
||
| for row in feedback_rows: | ||
| pid = int(row.paper_ref_id or 0) | ||
| if pid <= 0: | ||
| continue | ||
| normalized_action = self._normalize_feedback_action(str(row.action or "")) | ||
| if normalized_action == "save": | ||
| saved_track_membership[pid].add(int(row.track_id or 0)) | ||
|
|
||
| # Per-track state: first row encountered in descending | ||
| # timestamp order is the effective state for that | ||
| # (paper, track) pair. | ||
| tid = int(row.track_id or 0) | ||
| key = (pid, tid) | ||
| if tid > 0 and key not in latest_per_track: | ||
| latest_per_track[key] = normalized_action | ||
|
|
||
| # Global latest save/unsave per paper (track-agnostic) | ||
| if pid not in latest_save_state: | ||
| latest_save_state[pid] = (normalized_action == "save", row.ts) | ||
|
|
||
| # Build membership mapping from effective per-track states. | ||
| for (pid, tid), action in latest_per_track.items(): | ||
| if action == "save": | ||
| saved_track_membership[pid].add(tid) |
There was a problem hiding this comment.
The logic to build saved_track_membership can be made more efficient. Currently, you iterate through feedback_rows to populate latest_per_track, and then iterate through latest_per_track to build saved_track_membership. You can combine these into a single loop, which would avoid creating the intermediate latest_per_track dictionary and improve performance by reducing iterations.
seen_per_track: set[tuple[int, int]] = set()
for row in feedback_rows:
pid = int(row.paper_ref_id or 0)
if pid <= 0:
continue
normalized_action = self._normalize_feedback_action(str(row.action or ""))
# Per-track state: first row encountered in descending
# timestamp order is the effective state for that
# (paper, track) pair.
tid = int(row.track_id or 0)
key = (pid, tid)
if tid > 0 and key not in seen_per_track:
seen_per_track.add(key)
if normalized_action == "save":
saved_track_membership[pid].add(tid)
# Global latest save/unsave per paper (track-agnostic)
if pid not in latest_save_state:
latest_save_state[pid] = (normalized_action == "save", row.ts)| setUpdatingAction(null) | ||
| } | ||
| }, []) | ||
| const data = await res.json() |
Summary
This PR refines the paper Saved page UX and fixes the track‑scoped filtering bug:
Unsavenow goes through the unified feedback API so items are actually removed.cv,llm, etc.) now show only papers that are currently saved in that track instead of “any track that eversaved it”.
Changes
1) Saved papers table layout (frontend)
File:
web/src/components/research/SavedPapersList.tsxTable className="table-fixed w-full".w-[50px]Title:w-[40%], left alignedSource:w-[14%], left alignedSaved:w-[16%], centeredJudge:w-[10%], centeredStatus:w-[10%], centeredActions:w-[10%], right alignedTitlecolumn:truncate+title={paper.title}so long titles show a tooltip on hover instead of stretching the table.Saveddates,Judgescore+recommendation, andStatusbadge are centered for easier scanning.Sourcecolumn useswhitespace-nowrapto keep the badge compact.效果:长标题不会再把
Source/Judge等列挤乱,鼠标放上去还能看到完整论文题目。2) Unified
Unsavewith feedback API (frontend)File:
web/src/components/research/SavedPapersList.tsxReplaced the old library endpoint:
which only worked when paper_feedback.paper_id was the internal numeric ID.
New behaviour uses the same feedback pipeline as the Research page:
POST /api/research/papers/feedback
{
user_id: "default",
track_id: selectedTrackId,
paper_id: externalId || String(paperId),
action: "unsave",
...
}
This fixes the "Paper not in library" case where:
Now save & unsave always go through the same API and identity model.
3) Track‑scoped saved filtering (backend)
File: src/paperbot/infrastructure/stores/research_store.py
Method: list_saved_papers(...)
Previous behaviour:
to All Tracks.
New behaviour:
Still reads all save / unsave rows for the user, ordered by descending timestamp.
Tracks effective state per paper/track pair:
latest_per_track[(paper_ref_id, track_id)] = latest_action # save or unsave
Only the first row in descending order is taken as the state for that (paper, track) pair.
Builds saved_track_membership only from entries where the effective action is save:
for (pid, tid), action in latest_per_track.items():
if action == "save":
saved_track_membership[pid].add(tid)
Global saved_at_by_paper logic stays the same and is used for the All Tracks view.
As a result:
because it was saved there once in history.
———
Testing
Local dev environment:
Manual checks:
"Paper not in library" errors.
———
Notes
expectations.