Skip to content

feat(ui): make kopaiClient a param#64

Merged
Vunovati merged 1 commit into
mainfrom
feat/ui-kopai-client-param
Feb 24, 2026
Merged

feat(ui): make kopaiClient a param#64
Vunovati merged 1 commit into
mainfrom
feat/ui-kopai-client-param

Conversation

@Vunovati
Copy link
Copy Markdown
Collaborator

@Vunovati Vunovati commented Feb 24, 2026

Summary by CodeRabbit

  • New Features
    • Observability page now supports optional configuration for enhanced flexibility and usability.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 24, 2026

📝 Walkthrough

Walkthrough

The ObservabilityPage component is modified to accept an optional KopaiClient prop. A lazy default client initialization is implemented, allowing the component to use a provided client or fall back to a lazily-instantiated default when none is supplied.

Changes

Cohort / File(s) Summary
Component Props Enhancement
packages/ui/src/pages/observability.tsx
Added ObservabilityPageProps interface with optional client field. Updated ObservabilityPage to accept props and implement lazy default client pattern via getDefaultClient(). Component now resolves active client from props or default, passing it to KopaiSDKProvider.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A client now comes wrapped in props so fine,
With defaults so lazy, they arrive just in time!
No more hardcoded paths down the long warren trail,
Flexibility blooms—this component won't fail! 🌿✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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 accurately describes the main change: making the KopaiClient a parameter to ObservabilityPage via props.

✏️ 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 feat/ui-kopai-client-param

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.

@Vunovati Vunovati force-pushed the feat/ui-kopai-client-param branch from 5f6d620 to ab14c0b Compare February 24, 2026 14:40
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.

🧹 Nitpick comments (1)
packages/ui/src/pages/observability.tsx (1)

742-746: Confirm default KopaiClient lifecycle is safe to cache globally.

The module-level singleton may hold sockets, timers, or auth state across unmounts/tests. If the SDK expects cleanup or per-mount isolation, this could leak resources. Please verify the KopaiClient lifecycle contract and consider component-scoped memoization with optional cleanup if needed.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/ui/src/pages/observability.tsx` around lines 742 - 746, The
module-scoped singleton using _defaultClient and getDefaultClient may leak
sockets/timers/auth across mounts/tests; verify KopaiClient's lifecycle contract
and if it requires per-instance cleanup or isolation, remove the module-level
cache and instead instantiate KopaiClient inside the component (e.g., via
React.useMemo or useRef) so each mount gets its own client, and add explicit
cleanup (call the SDK's close/dispose/logout method) in useEffect cleanup;
alternatively, provide explicit init()/dispose() functions that wrap KopaiClient
so tests can reset the global instance if truly necessary.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/ui/src/pages/observability.tsx`:
- Around line 742-746: The module-scoped singleton using _defaultClient and
getDefaultClient may leak sockets/timers/auth across mounts/tests; verify
KopaiClient's lifecycle contract and if it requires per-instance cleanup or
isolation, remove the module-level cache and instead instantiate KopaiClient
inside the component (e.g., via React.useMemo or useRef) so each mount gets its
own client, and add explicit cleanup (call the SDK's close/dispose/logout
method) in useEffect cleanup; alternatively, provide explicit init()/dispose()
functions that wrap KopaiClient so tests can reset the global instance if truly
necessary.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 57e467b and ab14c0b.

📒 Files selected for processing (1)
  • packages/ui/src/pages/observability.tsx

@Vunovati Vunovati merged commit 35ef79d into main Feb 24, 2026
2 checks 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.

1 participant