Skip to content

Docs UI: show recently uploaded/cretaed on the list#62

Merged
nishika26 merged 2 commits intomainfrom
enhancement/doc_kb_order
Mar 10, 2026
Merged

Docs UI: show recently uploaded/cretaed on the list#62
nishika26 merged 2 commits intomainfrom
enhancement/doc_kb_order

Conversation

@nishika26
Copy link
Copy Markdown
Contributor

@nishika26 nishika26 commented Mar 10, 2026

Target issue is #63

Notes

  • Improvements
    • Collections and documents are now sorted by most recent insertion date first, ensuring latest items appear prominently.
    • Can preview documents of knowledge base even when knowledeg base creation is in process

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 10, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e7655a20-bc46-4fa5-a504-7cde9a1d63f9

📥 Commits

Reviewing files that changed from the base of the PR and between 609ef85 and 4f277bd.

📒 Files selected for processing (1)
  • app/knowledge-base/page.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/knowledge-base/page.tsx

📝 Walkthrough

Walkthrough

Added backend query param include_url=true to collection GET, sorted documents and collections by inserted_at (descending) before updating state, added debug logging for sorted lists, and updated document preview flow to fetch document details asynchronously when an API key is available.

Changes

Cohort / File(s) Summary
API: collections route
app/api/collections/[collection_id]/route.ts
Backend API call now includes include_url=true alongside include_docs=true; no public signature changes.
Document page
app/document/page.tsx
Sorts fetched documents by inserted_at (desc) before calling setDocuments; adds debug logging for the sorted list.
Knowledge base page
app/knowledge-base/page.tsx
Combines optimistic and real collections, sorts by inserted_at (desc); sorts fetched documents by inserted_at (desc); document preview now performs async fetch to /api/document/{id} when an API key exists and updates preview data.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

ready-for-review

Suggested reviewers

  • Prajna1999
  • vprashrex

Poem

🐰
I hopped through lists and put them in line,
New URLs peeking, sorted by time.
Previews fetch secrets when keys are in paw,
Logs hum softly — that's the new law. 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Docs UI: show recently uploaded/cretaed on the list' directly relates to the main changes: sorting collections and documents by insertion date in descending order to display most recent items first.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch enhancement/doc_kb_order

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@app/knowledge-base/page.tsx`:
- Around line 467-471: Remove the explicit full-page reload: when the job status
variable (status) equals 'successful' do not call window.location.reload();
instead rely on the existing fetchCollections() polling/refresh mechanism
already invoked when jobs complete (fetchCollections()). Locate the block that
checks if (status.toLowerCase() === 'successful') and delete the
window.location.reload() call so state is preserved and updates come via
fetchCollections().

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b41d80b3-4468-4260-9b37-f71f4f23b66c

📥 Commits

Reviewing files that changed from the base of the PR and between 2613ee7 and 609ef85.

📒 Files selected for processing (3)
  • app/api/collections/[collection_id]/route.ts
  • app/document/page.tsx
  • app/knowledge-base/page.tsx

Comment thread app/knowledge-base/page.tsx Outdated
@nishika26 nishika26 self-assigned this Mar 10, 2026
@nishika26 nishika26 added the enhancement New feature or request label Mar 10, 2026
@nishika26 nishika26 linked an issue Mar 10, 2026 that may be closed by this pull request
@nishika26 nishika26 merged commit 455136b into main Mar 10, 2026
1 check passed
@Ayush8923 Ayush8923 deleted the enhancement/doc_kb_order branch March 20, 2026 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Doc upload: show recently uploaded/created resources

2 participants