Skip to content

fix(ui): posthog guard, dynamic import loading, compact variant, rebase cleanup#4196

Merged
waleedlatif1 merged 2 commits intostagingfrom
waleedlatif1/posthog-guard-fix
Apr 16, 2026
Merged

fix(ui): posthog guard, dynamic import loading, compact variant, rebase cleanup#4196
waleedlatif1 merged 2 commits intostagingfrom
waleedlatif1/posthog-guard-fix

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

Summary

  • Add missing typeof guard on posthog.sessionRecordingStarted to match startSessionRecording guard
  • Add loading: () => null to all dynamically imported modals (AuthModal, DemoRequestModal)
  • Replace !important CSS overrides on UserMessageContent with proper compact prop
  • Replace useEffect ResizeObserver with callback ref pattern in QueuedMessages
  • Memoize computeMentionRanges in UserMessageContent
  • Remove duplicate handleStopGeneration / handleCopilotStopGeneration rebase artifacts

Type of Change

  • Bug fix
  • Code quality improvement

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

TheodoreSpeaks and others added 2 commits April 15, 2026 22:40
* feat(posthog): Add tracking on mothership abort (#4023)

Co-authored-by: Theodore Li <theo@sim.ai>

* fix(login): fix captcha headers for manual login  (#4025)

* fix(signup): fix turnstile key loading

* fix(login): fix captcha header passing

* Catch user already exists, remove login form captcha
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Apr 16, 2026 6:30am

Request Review

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 16, 2026

PR Summary

Low Risk
Changes are confined to UI rendering and analytics guards; main risk is minor behavior differences in modal loading and queued message layout/resize handling.

Overview
Improves landing-page modal loading by adding explicit loading: () => null fallbacks to dynamically imported AuthModal/DemoRequestModal components, reducing transient loading UI.

Hardens analytics initialization by guarding posthog.sessionRecordingStarted before calling it, preventing runtime errors in environments where the API is missing.

Refines workspace message UI: QueuedMessages now uses a callback-ref ResizeObserver pattern, and UserMessageContent adds a compact variant (used by queued messages) while memoizing mention-range computation to avoid repeated parsing during renders.

Reviewed by Cursor Bugbot for commit 904ab7d. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 16, 2026

Greptile Summary

This PR bundles five focused fixes: a missing typeof guard on posthog.sessionRecordingStarted, loading: () => null added to all unguarded dynamic modal imports on landing pages, a callback-ref replacement for the useEffect-based ResizeObserver in QueuedMessages, a compact prop that replaces !important overrides in UserMessageContent (with computeMentionRanges memoised), and removal of duplicate stop-generation handlers left over from a rebase.

Confidence Score: 5/5

Safe to merge — all changes are targeted bug fixes and code quality improvements with no new regressions introduced.

All five fix areas are well-scoped: the PostHog typeof guard is correct, loading: () => null follows the established pattern, the callback-ref ResizeObserver pattern is a valid improvement with proper cleanup, the compact prop correctly replaces !important overrides, and the duplicate handler removal is a clean rebase fix. No P0/P1 issues found.

No files require special attention.

Important Files Changed

Filename Overview
apps/sim/app/_shell/providers/session-provider.tsx Adds the missing typeof posthog.sessionRecordingStarted === 'function' guard before calling sessionRecordingStarted(), matching the existing guard on startSessionRecording. Correct fix.
apps/sim/app/workspace/[workspaceId]/home/components/queued-messages/queued-messages.tsx Replaces useEffect + ResizeObserver with a callback-ref pattern; correctly disconnects the observer on element removal/unmount by checking roRef.current, and creates a new observer on element mount.
apps/sim/app/workspace/[workspaceId]/home/components/user-message-content/user-message-content.tsx Adds a compact prop with COMPACT_CLASSES (truncate-based single-line layout) replacing prior !important CSS overrides, and wraps computeMentionRanges in useMemo. Both changes are correct; plainMentions and compact are used together at the call site.
apps/sim/app/(landing)/components/navbar/navbar.tsx Adds loading: () => null to the AuthModal dynamic import, consistent with hero.tsx and other landing pages.
apps/sim/app/workspace/[workspaceId]/home/home.tsx Removes duplicate handleStopGeneration rebase artifact; single clean definition remains at line 204.
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/panel.tsx Removes duplicate handleCopilotStopGeneration rebase artifact; single clean definition remains at line 395.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[SessionProvider mounts] --> B[loadSession]
    B --> C{isPending false?}
    C --> D[import posthog-js]
    D --> E{posthog.identify is function?}
    E -- no --> Z[return early]
    E -- yes --> F{data.user exists?}
    F -- no --> G[posthog.reset]
    F -- yes --> H[posthog.identify]
    H --> I{startSessionRecording AND sessionRecordingStarted are functions?}
    I -- no --> Z
    I -- yes --> J{sessionRecordingStarted returns false?}
    J -- already started --> Z
    J -- not started --> K[startSessionRecording]
Loading

Reviews (1): Last reviewed commit: "fix(ui): posthog guard, dynamic import l..." | Re-trigger Greptile

@waleedlatif1 waleedlatif1 merged commit 0464a57 into staging Apr 16, 2026
14 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/posthog-guard-fix branch April 16, 2026 06:53
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