Skip to content

feat(useAccessibleOrgs): accept triggerGetKeys as parameter for multi-app support - #1796

Merged
banana-three-join merged 1 commit into
layer5io:masterfrom
rishiraj38:fix/accessible-orgs-inject-trigger
Aug 13, 2026
Merged

feat(useAccessibleOrgs): accept triggerGetKeys as parameter for multi-app support#1796
banana-three-join merged 1 commit into
layer5io:masterfrom
rishiraj38:fix/accessible-orgs-inject-trigger

Conversation

@rishiraj38

@rishiraj38 rishiraj38 commented Aug 13, 2026

Copy link
Copy Markdown
Member

Description

The useAccessibleOrgs hook needs to work in both meshery-cloud and meshery. These two apps use different API layers to fetch user keys — meshery-cloud uses @meshery/schemas/cloudApi (direct cloud server) while meshery uses @meshery/schemas/mesheryApi (meshery server).

Previously, the hook hardcoded the cloudApi import, which meant Meshery could not reuse it without duplicating the entire logic. This PR makes triggerGetKeys a required parameter so each app passes its own RTK Query lazy trigger, keeping all the permission-checking, caching, and parallel-query logic in one place.

Changes:

  • Removed internal useLazyGetUserKeysQuery import from cloudApi.
  • Added triggerGetKeys to UseAccessibleOrgsOptions
  • Exported new TriggerGetKeys type for consumer convenience

Realated PRs

Meshery-Cloud - https://github.com/layer5io/meshery-cloud/pull/5971
Meshery - meshery/meshery#21366

Meshery-Cloud

Screen.Recording.2026-08-13.at.3.03.00.PM.mov

Meshery

Screen.Recording.2026-08-13.at.3.03.52.PM.mov

Signed commits

  • Yes, I signed my commits.

Summary by CodeRabbit

  • New Features
    • Added support for configuring organization accessibility checks with either cloud or Meshery API connections.
    • Exposed a reusable trigger type for fetching organization keys.
  • Documentation
    • Updated usage guidance and examples to demonstrate configuration for both supported API environments.

…-app support

Signed-off-by: Rishi Raj <rishiraj438gt@gmail.com>
@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: adb1e388-5263-4370-a93c-095202b08391

📥 Commits

Reviewing files that changed from the base of the PR and between 5ec2f6e and eb088b8.

📒 Files selected for processing (2)
  • src/custom/useAccessibleOrgs.ts
  • src/index.tsx

📝 Walkthrough

Walkthrough

The useAccessibleOrgs hook now receives its key-fetching trigger from callers. The new TriggerGetKeys type is exported from the hook module and the package entrypoint. Documentation and examples cover cloud and meshery transports.

Changes

Accessible organization key retrieval

Layer / File(s) Summary
Trigger contract and hook integration
src/custom/useAccessibleOrgs.ts
Adds the TriggerGetKeys type, requires triggerGetKeys, updates usage documentation, and replaces the internal lazy-query trigger with the supplied callback.
Public type export
src/index.tsx
Re-exports TriggerGetKeys from the package entrypoint.

Estimated code review effort: 2 (Simple) | ~10 minutes

Mergeability Score: 🔵 Low · up to eb088

The hook now supports multiple API backends, but its organization cache could retain results from the wrong backend if the trigger source changes while the hook remains mounted. The PR is mergeable with explicit owner awareness or follow-up to make the trigger lifecycle immutable or reset caches when the source changes, and to verify external callers pass the correct trigger.

Possibly related PRs

Suggested reviewers: simihablo, khushambansal

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding a required triggerGetKeys parameter to useAccessibleOrgs for multi-app support.
✨ 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.

@banana-three-join
banana-three-join merged commit fe9e80a into layer5io:master Aug 13, 2026
6 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.

2 participants