Skip to content

Fix test key refetch on window focus#906

Open
AnoshanJ wants to merge 1 commit into
wso2:mainfrom
AnoshanJ:fix/console-test-key-caching
Open

Fix test key refetch on window focus#906
AnoshanJ wants to merge 1 commit into
wso2:mainfrom
AnoshanJ:fix/console-test-key-caching

Conversation

@AnoshanJ
Copy link
Copy Markdown
Contributor

@AnoshanJ AnoshanJ commented May 18, 2026

Summary

  • always refetch console test API keys when the tab/window regains focus
  • prevents focused tabs from reusing cached test keys after another tab rotates the key

Test

  • npm run build in console/workspaces/libs/api-client

Summary by CodeRabbit

  • Bug Fixes
    • Test agent API key now automatically refreshes when you return to the application after switching browser tabs, ensuring the key remains up-to-date.

Review Change Stack

Signed-off-by: Anoshan Jayahanthan <101160077+AnoshanJ@users.noreply.github.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 18, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c4751694-9566-43a1-bdb5-1e9a3617b955

📥 Commits

Reviewing files that changed from the base of the PR and between 219b337 and f162cd8.

📒 Files selected for processing (1)
  • console/workspaces/libs/api-client/src/hooks/agent-api-keys.ts

📝 Walkthrough

Walkthrough

The useTestAgentAPIKey React Query hook is updated to refetch the short-lived test agent API key when the browser window regains focus. The refetchOnWindowFocus setting changes from false to "always", ensuring the key remains current during active use.

Changes

Agent API Key Test Window Focus Refetch

Layer / File(s) Summary
Window focus refetch enablement
console/workspaces/libs/api-client/src/hooks/agent-api-keys.ts
useTestAgentAPIKey now refetches on window focus by setting refetchOnWindowFocus to "always" instead of false, keeping the short-lived test API key fresh when the user returns to the browser tab.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A focused hook awakens with might,
When eyes return to the glowing light,
The test key refreshes, alert and spry,
Watching the window as users drift by! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is incomplete. It lacks most required sections from the template (Purpose, Goals, Approach, User stories, Release note, Documentation, etc.). Expand the description to include Purpose, Goals, Approach, Release note, and other relevant sections from the provided template.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: enabling test key refetch on window focus.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

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.

1 participant