Skip to content

fix: handle internal user preview mode before validating clientId/companyId - #91

Merged
makeitraina merged 1 commit into
mainfrom
fix/internal-user-preview-mode
Aug 6, 2025
Merged

fix: handle internal user preview mode before validating clientId/companyId#91
makeitraina merged 1 commit into
mainfrom
fix/internal-user-preview-mode

Conversation

@makeitraina

Copy link
Copy Markdown
Member

Summary

Fixed logic that checks clientId/companyId requirements when rendering the client preview page. When internalUserId is provided, the app now correctly shows the 'CRM preview is not available' message instead of throwing an error.

Changes

  • Reordered validation logic in src/app/client-preview/page.tsx
  • Check for token payload existence first
  • Call getPreviewMode() to handle internal users before validating clientId/companyId
  • Only validate clientId/companyId after determining it's not a preview mode scenario

Test plan

  • Test with token containing only internalUserId - should show 'CRM preview is not available'
  • Test with token containing clientId and companyId - should render normally
  • Test with malformed token - should show appropriate error

…panyId

When internalUserId is provided in the token payload, the user is viewing
company or client details pages that don't support preview. This should
show the "CRM preview is not available" message instead of throwing an
error about missing clientId or companyId.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 6, 2025

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
client-home 🔄 Building (Inspect) Visit Preview 💬 Add feedback Aug 6, 2025 3:32pm

@sentry

sentry Bot commented Aug 6, 2025

Copy link
Copy Markdown

🔍 Existing Issues For Review

Your pull request is modifying functions with the following pre-existing issues:

📄 File: src/app/client-preview/page.tsx

Function Unhandled Issue
ClientPreviewPage Error: Failed to parse token payload ClientPrevie...
Event Count: 971 Affected Users: 0
ClientPreviewPage TypeError: Cannot read properties of undefined (reading 'name') ClientPreviewPage(server/app/client-preview/custom-app-base/src/app/clien...
Event Count: 24 Affected Users: 0
ClientPreviewPage Error: No client found with 'e8958be71cabae374be1b8702c93838def30b94972d7c7585744d3191dfe8aad9350c536545e8d81012db288078643721c5452141a177100c555dd45005bbfb19b697dc443edb64035e3fac7dfdd42f16db847cdb982aedf97aaedf8b453b838464550e9fa91addfa68c8009b9cfcca22067... ...
Event Count: 1 Affected Users: 0

Did you find this useful? React with a 👍 or 👎

@makeitraina
makeitraina requested a review from arpandhakal August 6, 2025 15:33
@makeitraina
makeitraina merged commit 9fc36b6 into main Aug 6, 2025
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