Skip to content

fix(emcn): repair unstyled UI after package extraction#5258

Merged
waleedlatif1 merged 1 commit into
stagingfrom
fix/emcn-runtime-regression
Jun 29, 2026
Merged

fix(emcn): repair unstyled UI after package extraction#5258
waleedlatif1 merged 1 commit into
stagingfrom
fix/emcn-runtime-regression

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

Two runtime regressions from the @sim/emcn extraction (#5257), both invisible to typecheck:

  • App-wide crash on every workspace route (logs, chat, workflows, …). optimizePackageImports: ['@sim/emcn'] rewrites barrel imports to direct subpaths and, for this barrel, duplicates the toast module — so <ToastProvider> (workspace layout) and useToast() (workspace permissions provider, rendered on every route) ended up with different ToastContext objects. useToast then threw must be used within <ToastProvider>, which the route error.tsx boundaries caught ("Failed to load …"). The simple Button-only error fallback still rendered, which is why the error UI showed. Fix: removed @sim/emcn from optimizePackageImports (normal bundling already tree-shakes it; the optimizer is incompatible with the barrel's collision re-exports).
  • emcn components rendered unstyled (e.g. oversized buttons). After moving emcn out of apps/sim/components, its source fell outside apps/sim's Tailwind content globs and docs' Tailwind v4 auto-content scope (which excludes node_modules), so utility classes used only inside emcn stopped being generated. Fix: added packages/emcn/src to apps/sim's Tailwind content and a @source to docs' global CSS.

Type of Change

  • Bug fix

Testing

  • Root causes verified by code analysis (the useToast null-context throw + the optimizer/module-duplication mechanism). Config-only changes; typecheck unaffected. Verified live against the running app.

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)

…tion

Two regressions from moving emcn into @sim/emcn:

1. optimizePackageImports['@sim/emcn'] rewrote barrel imports to direct subpaths, duplicating the toast module so ToastProvider (layout) and useToast (workspace permissions provider) resolved different ToastContext objects — useToast threw 'must be used within <ToastProvider>' on every workspace route. Removed @sim/emcn from optimizePackageImports.

2. emcn's source left apps/sim's Tailwind content globs (and docs' v4 auto-content scope, which excludes node_modules), so utility classes used only inside emcn components stopped generating and components rendered unstyled. Added the package to apps/sim's Tailwind content and a @source to docs.
@vercel

vercel Bot commented Jun 29, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Jun 29, 2026 6:35am

Request Review

@cursor

cursor Bot commented Jun 29, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Config-only Tailwind and Next.js import-optimization tweaks; no auth, data, or application logic changes.

Overview
Repairs two post-extraction regressions with build config only—no runtime code in @sim/emcn.

Workspace routes were failing because experimental.optimizePackageImports included @sim/emcn, which rewrote barrel imports and could load the toast module twice. That split ToastProvider and useToast() across different React contexts and triggered “must be used within ToastProvider” on every workspace page. @sim/emcn is removed from that list so the package bundles normally.

Unstyled emcn UI happened because Tailwind stopped scanning packages/emcn/src after the move out of apps/sim. The sim app adds that path to tailwind.config content, and docs registers the same tree via Tailwind v4 @source in global.css so utilities used only inside the package are generated again.

Reviewed by Cursor Bugbot for commit 9c5c0d4. Configure here.

@greptile-apps

greptile-apps Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes styling and runtime regressions from the EMCN package extraction.

  • Removes @sim/emcn from Next package import optimization.
  • Adds the EMCN source package to the Sim Tailwind content scan.
  • Adds an EMCN source directive for the docs Tailwind build.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
apps/docs/app/global.css Adds the EMCN source package to the docs Tailwind source scan.
apps/sim/next.config.ts Stops optimizing @sim/emcn imports while keeping the package transpiled.
apps/sim/tailwind.config.ts Adds the EMCN source package to the Sim Tailwind content scan.

Reviews (2): Last reviewed commit: "fix(emcn): repair app-wide crash and uns..." | Re-trigger Greptile

Comment thread apps/sim/tailwind.config.ts
@waleedlatif1 waleedlatif1 changed the title fix(emcn): repair app-wide crash and unstyled UI after package extraction fix(emcn): repair unstyled UI after package extraction Jun 29, 2026
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 9c5c0d4. Configure here.

@waleedlatif1 waleedlatif1 merged commit f5f87de into staging Jun 29, 2026
17 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/emcn-runtime-regression branch June 29, 2026 06:52
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