Skip to content

fix(instance): connect on deep-link to refresh modules#6230

Open
trippyogi wants to merge 3 commits into
redis:mainfrom
trippyogi:fix/6080-deep-link-modules
Open

fix(instance): connect on deep-link to refresh modules#6230
trippyogi wants to merge 3 commits into
redis:mainfrom
trippyogi:fix/6080-deep-link-modules

Conversation

@trippyogi

@trippyogi trippyogi commented Jul 17, 2026

Copy link
Copy Markdown

Summary

  • Call checkConnectToInstanceAction when mounting InstancePage, matching the DB picker / Redis Stack entry path.
  • Refresh modules via GET /databases/:id/connect before fetching instance data used by Vector Search guards.
  • Fixes Docker preconfigured databases (modules: []) opened via /0/vector-search incorrectly showing Redis Search as unavailable.

Fixes #6080

Test plan

  • InstancePage.spec.tsx — 9/9 passed
  • Fresh preconfigured DB with modules: []; deep-link /0/vector-search triggers connect and populates search module
  • UI: deep-link Search shows indexes (e.g. idx:trie), not the RQE unavailable empty state
  • /0/browser still loads after deep-link / picker entry
  • Regression: open DB from picker, then Search — still works

Note

Medium Risk
Touches core instance mount/connect flow and when global connected state is reset; wrong reset logic could break routing or leave stale DB context, but scope is limited to InstancePage and covered by updated tests.

Overview
InstancePage now goes through checkConnectToInstanceAction on mount (same path as the DB picker / Redis Stack) instead of firing fetchConnectedInstance*, config, and recommendations directly. Instance fetches run in a loadInstanceData callback after connect succeeds or fails so connectedInstance.loading always settles—fixing Vector Search spinning when modules were empty until GET /databases/:id/connect refreshed them.

Connected-instance reset is conditional: resetConnectedInstance runs only when the store already has a different connected id (DB switch). If the route id matches the current connected id (e.g. Redis Stack pre-set before navigation), reset is skipped so ProtectedRoute does not bounce to home.

Tests seed per-case Redux state, expect resetConnectedInstance on switch, and add a case asserting no reset when already on the same instance id.

Reviewed by Cursor Bugbot for commit 0ce6401. Bugbot is set up for automated code reviews on this repo. Configure here.

InstancePage now calls checkConnectToInstanceAction before fetching
instance data so Redis modules are refreshed via GET /connect. This
fixes Vector Search showing unavailable when deep-linking to
/0/vector-search on preconfigured Docker databases.

Fixes redis#6080
@CLAassistant

CLAassistant commented Jul 17, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@trippyogi
trippyogi marked this pull request as ready for review July 17, 2026 18:55
@trippyogi
trippyogi requested a review from a team as a code owner July 17, 2026 18:55

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 81976eb9fb

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

dispatch(fetchRecommendationsAction(connectionInstanceId))
},
undefined,
contextInstanceId !== connectionInstanceId,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Avoid clearing RedisStack's connected id

In the RedisStack build, RedisStackRoutes first connects, calls setConnectedInstanceId, and pushes /:id/browser; those routes are wrapped by ProtectedRoute, which redirects to Pages.home whenever connectedInstance.id is empty. On this first InstancePage mount the app context is still empty, so this reset flag is true and checkConnectToInstanceAction synchronously dispatches resetConnectedInstance before the async connect completes. That clears the id after the route was admitted, causing ProtectedRoute to immediately redirect back home and preventing /0/browser from staying open in the RedisStack path.

Useful? React with 👍 / 👎.

Only reset connectedInstance when switching away from a different DB.
Redis Stack sets the connected id before routing into InstancePage;
resetting it cleared ProtectedRoute and bounced back to home.
@trippyogi

Copy link
Copy Markdown
Author

Addressed Codex feedback: resetConnectedInstance now only runs when switching away from a different already-connected DB (connectedInstanceId !== connectionInstanceId).

Redis Stack sets connectedInstance.id before mounting InstancePage, so we no longer clear it mid-route (which was bouncing ProtectedRoute back to home).

Added a unit test covering the same-id / no-reset case. InstancePage.spec: 10/10 passed.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 2ac110e. Configure here.

Comment thread redisinsight/ui/src/pages/instance/InstancePage.tsx
Comment thread redisinsight/ui/src/pages/instance/InstancePage.spec.tsx

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2ac110e7c7

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +87 to +92
() => {
dispatch(fetchConnectedInstanceAction(connectionInstanceId))
dispatch(getDatabaseConfigInfoAction(connectionInstanceId))
dispatch(fetchConnectedInstanceInfoAction(connectionInstanceId))
dispatch(fetchRecommendationsAction(connectionInstanceId))
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Handle failed deep-link connects

When a user opens a bookmarked/direct instance route and GET /databases/:id/connect fails (for example a temporarily unavailable DB returning 424), this success callback never runs and no failure callback is provided. Since the old unconditional fetchConnectedInstanceAction is now only dispatched here, a fresh / :id /vector-search load leaves connectedInstance.loading as undefined, which VectorSearchPageRouter treats as loading forever; Browser children also keep connectedInstance.id empty. Please update the failure path to either redirect/show a terminal state or still fetch/reset the connected instance state.

Useful? React with 👍 / 👎.

Always fetch connected instance/config/info after connect succeeds or
fails so connectedInstance.loading settles and Vector Search does not
spin forever. Drop unused getRecommendations import in the spec.
@trippyogi

Copy link
Copy Markdown
Author

Addressed Bugbot findings on 2ac110e:

  1. Connect failure / loadingloadInstanceData now runs on both connect success and failure so connectedInstance.loading settles (Vector Search no longer spins forever).
  2. Unused import — removed getRecommendations from InstancePage.spec.tsx.

InstancePage.spec: 10/10 passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Docker Redis Insight does not detect Redis Search when opening a preconfigured database through a direct route

2 participants