Skip to content

Fix admin settings configuration sliders#33

Merged
peterod99 merged 1 commit intomainfrom
claude/fix-admin-settings-sliders-GJwP9
Jan 6, 2026
Merged

Fix admin settings configuration sliders#33
peterod99 merged 1 commit intomainfrom
claude/fix-admin-settings-sliders-GJwP9

Conversation

@peterod99
Copy link
Copy Markdown
Owner

@peterod99 peterod99 commented Jan 6, 2026

…ions

The admin settings sliders weren't working because RLS policies require tenant_id = get_current_tenant_id(). When the database session context wasn't set, upsert operations were silently failing.

This fix ensures the tenant context is set via set_tenant_context RPC before both getValue and setValue operations in the AdminSettingsCache.

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Improved error handling and logging for admin settings operations
    • Enhanced reliability of admin settings initialization and queries

✏️ Tip: You can customize this high-level summary in your review settings.

…ions

The admin settings sliders weren't working because RLS policies require
tenant_id = get_current_tenant_id(). When the database session context
wasn't set, upsert operations were silently failing.

This fix ensures the tenant context is set via set_tenant_context RPC
before both getValue and setValue operations in the AdminSettingsCache.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 6, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

This change adds tenant-scoped context initialization to the useOptimizedAdminSetting hook. Before executing admin_settings queries and upserts, the code now calls set_tenant_context via RPC to satisfy row-level security checks, with graceful error handling that logs warnings but continues execution.

Changes

Cohort / File(s) Summary
Tenant Context Initialization
src/hooks/useOptimizedAdminSetting.tsx
Added RPC calls to set_tenant_context before admin_settings queries and upserts to ensure tenant-scoped security compliance; includes error logging and graceful failure handling that permits continuation despite RPC failures

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Ah, context hops before the quest,
Tenant-scoped and setting best!
RPC calls with warnings kind,
Leave no RLS check behind!


📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Free

📥 Commits

Reviewing files that changed from the base of the PR and between 1e42ffd and 4d4549b.

📒 Files selected for processing (1)
  • src/hooks/useOptimizedAdminSetting.tsx

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands and usage tips.

@peterod99 peterod99 merged commit 40dbfdb into main Jan 6, 2026
1 of 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.

2 participants