Skip to content

fix: prevent navigation on invalid organization search#68

Open
Ri1tik wants to merge 1 commit into
AOSSIE-Org:mainfrom
Ri1tik:fix/invalid-org-navigation
Open

fix: prevent navigation on invalid organization search#68
Ri1tik wants to merge 1 commit into
AOSSIE-Org:mainfrom
Ri1tik:fix/invalid-org-navigation

Conversation

@Ri1tik
Copy link
Copy Markdown
Contributor

@Ri1tik Ri1tik commented Jun 5, 2026

Addressed Issues:

Fixes #

Screenshots/Recordings:

Before

  • Entering a non-existent GitHub organization redirected users to the Overview page even when no valid data was loaded.
  • This resulted in an empty dashboard state.

https://drive.google.com/file/d/17xp34CqaO0t8KXSdBCqYWnp3GsTrDgj7/view?usp=drive_link

After

  • Invalid organization searches now remain on the Home page.
  • A user-friendly error message is displayed instead of navigating to the Overview page.
  • Navigation occurs only after a successful organization fetch and analytical model generation.

https://drive.google.com/file/d/1LR-OxsV-36fUpHrr1clPqqjwFcuPAjUx/view?usp=drive_link

Additional Notes:

Changes Made

  • Updated explore() in AppContext to return a success/failure status.
  • Modified Home page navigation logic to redirect to /overview only when exploration succeeds.

Impact

  • Prevents users from reaching an empty dashboard state.
  • Provides clearer feedback when organization names are incorrect.
  • Improves overall search and onboarding experience.

Checklist

  • My code follows the project's code style and conventions
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings or errors
  • I have joined the Discord server and I will share a link to this PR with the project maintainers there
  • I have read the Contributing Guidelines

⚠️ AI Notice - Important!

We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact.

Summary by CodeRabbit

  • Bug Fixes
    • Organization search now validates successful completion before navigating to the overview page, preventing navigation errors.
    • Updated browser cache storage system to improve data persistence and reliability.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 5, 2026

Worried about impact? Review this PR in Change Stack to explore blast radius before you approve or request changes.

Review Change Stack

Walkthrough

The PR adds success/failure signaling to the organization exploration flow: the explore function now returns a boolean, allowing HomePage to conditionally navigate only when exploration succeeds. The GitHub caching service updates its IndexedDB database name to orgexplorer_cache.

Changes

Org Exploration and Caching Updates

Layer / File(s) Summary
Explore return value contract
src/context/AppContext.jsx
The explore function explicitly returns true after updating oe_recent and false after setting user-facing error messages in the catch block.
Conditional navigation on explore success
src/pages/HomePage.jsx
The go function captures the boolean return value of explore(orgs) and executes navigate('/overview') only when that value is truthy, preventing navigation on exploration failures.
Cache database name update
src/services/github.js
The IndexedDB database name constant changes from orgexplorer_v2 to orgexplorer_cache, updating the cache persistence namespace.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested labels

Typescript Lang

Poem

🐰 A rabbit hops through explore's bright door,
Returns success or failure, no more;
HomePage now listens with careful ear,
To navigate only when all is clear.
The cache gets a fresher, newer name,
Persistence persists—the logic's the same! 🌟

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: preventing navigation when organization search is invalid, which directly addresses the core bug fix in the pull request.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@github-actions github-actions Bot added no-issue-linked PR has no linked issue frontend Frontend changes javascript JavaScript/TypeScript changes size/XS 1-10 lines changed first-time-contributor First time contributor labels Jun 5, 2026
@github-actions github-actions Bot added size/XS 1-10 lines changed and removed size/XS 1-10 lines changed labels Jun 5, 2026
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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/services/github.js`:
- Line 2: The DB_NAME constant was changed to 'orgexplorer_cache' which orphaned
the old 'orgexplorer_v2' DB; add startup cleanup logic (e.g., in the module
initialization or the function that opens the DB) to detect and delete the old
'orgexplorer_v2' IndexedDB database before or after opening the new DB so users
don't retain stale storage—use the DB_NAME constant for the new name and
explicitly call the browser IndexedDB deleteDatabase('orgexplorer_v2') (with
proper promise/error handling and logging) to remove the old database.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: eee8cfac-937c-4804-9341-bd6cde9965a9

📥 Commits

Reviewing files that changed from the base of the PR and between c0ced11 and 283996e.

📒 Files selected for processing (3)
  • src/context/AppContext.jsx
  • src/pages/HomePage.jsx
  • src/services/github.js

Comment thread src/services/github.js
@@ -1,5 +1,5 @@
// IndexedDB Cache (L2)
const DB_NAME = 'orgexplorer_v2'
const DB_NAME = 'orgexplorer_cache'
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Database rename invalidates existing cache and orphans old database.

Renaming the database from orgexplorer_v2 to orgexplorer_cache means all users' existing cached GitHub API responses become inaccessible. This will cause:

  • Cache misses on first requests after update, potentially increasing API calls and hitting rate limits.
  • The old orgexplorer_v2 database will remain in users' browsers, wasting storage space.

Consider adding cleanup code to delete the old database on initialization to prevent storage waste.

🧹 Proposed fix to clean up orphaned database
 // IndexedDB Cache (L2) 
 const DB_NAME = 'orgexplorer_cache'
+const OLD_DB_NAME = 'orgexplorer_v2'
 const STORE   = 'cache'
 const TTL_MS  = 3_600_000 // 1 hour
 
 function openDB() {
   return new Promise((resolve, reject) => {
     const req = indexedDB.open(DB_NAME, 1)
     req.onupgradeneeded = e => e.target.result.createObjectStore(STORE, { keyPath: 'k' })
     req.onsuccess  = e => resolve(e.target.result)
     req.onerror    = ()  => reject(req.error)
   })
 }
+
+// Clean up old database on first load
+if (typeof window !== 'undefined') {
+  indexedDB.deleteDatabase(OLD_DB_NAME)
+}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/services/github.js` at line 2, The DB_NAME constant was changed to
'orgexplorer_cache' which orphaned the old 'orgexplorer_v2' DB; add startup
cleanup logic (e.g., in the module initialization or the function that opens the
DB) to detect and delete the old 'orgexplorer_v2' IndexedDB database before or
after opening the new DB so users don't retain stale storage—use the DB_NAME
constant for the new name and explicitly call the browser IndexedDB
deleteDatabase('orgexplorer_v2') (with proper promise/error handling and
logging) to remove the old database.

@Ri1tik Ri1tik added the gsoc GSoC students label Jun 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

first-time-contributor First time contributor frontend Frontend changes gsoc GSoC students javascript JavaScript/TypeScript changes no-issue-linked PR has no linked issue size/XS 1-10 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant