Skip to content

Fix marketing funnel template creation error#32

Merged
peterod99 merged 1 commit intomainfrom
claude/fix-funnel-tenant-context-PTqzV
Jan 6, 2026
Merged

Fix marketing funnel template creation error#32
peterod99 merged 1 commit intomainfrom
claude/fix-funnel-tenant-context-PTqzV

Conversation

@peterod99
Copy link
Copy Markdown
Owner

@peterod99 peterod99 commented Jan 6, 2026

…template

The funnel template creation was failing with "Tenant context not available" error because it relied on RPC get_current_tenant_id for step creation, even though the tenantId was already validated and available in scope.

Changes:

  • funnelTemplatesService: Use existing tenantId variable instead of RPC call when inserting funnel_steps and optin_templates
  • funnelStepsService: Add optional explicitTenantId parameter with fallback chain (explicit -> RPC -> sessionStorage -> localStorage)

Summary by CodeRabbit

  • Bug Fixes
    • Improved tenant context resolution to better handle multi-tenant scenarios with fallback mechanisms, ensuring proper tenant identification during funnel operations and template management.

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

…template

The funnel template creation was failing with "Tenant context not available"
error because it relied on RPC get_current_tenant_id for step creation, even
though the tenantId was already validated and available in scope.

Changes:
- funnelTemplatesService: Use existing tenantId variable instead of RPC call
  when inserting funnel_steps and optin_templates
- funnelStepsService: Add optional explicitTenantId parameter with fallback
  chain (explicit -> RPC -> sessionStorage -> localStorage)
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 6, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

The pull request modifies tenant context resolution in funnel-related services. The createFunnelStep function now accepts an optional explicit tenant ID parameter with a fallback chain (explicit parameter → RPC call → browser storage), while createFunnelTemplate simplifies its tenant ID assignment by using a pre-validated tenant context instead of making a fresh RPC call.

Changes

Cohort / File(s) Summary
Tenant context resolution refactoring
src/services/funnelStepsService.ts, src/services/funnelTemplatesService.ts
funnelStepsService: Added optional explicitTenantId parameter to createFunnelStep; implemented fallback chain for tenant resolution (explicit → RPC → storage → error). funnelTemplatesService: Replaced RPC-derived currentTenantId with pre-validated tenantId for funnel_steps and optin_templates inserts.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A tenant tale with clearer ways,
No more just RPC calls all days,
Fallbacks nested, storage deep,
Context flows where logic creeps,
Funnel services now stand so bright,


📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Free

📥 Commits

Reviewing files that changed from the base of the PR and between 5388f9c and db85764.

📒 Files selected for processing (2)
  • src/services/funnelStepsService.ts
  • src/services/funnelTemplatesService.ts

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 1e42ffd 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