Skip to content

fix(prism): load prismjs core before language components#5262

Merged
waleedlatif1 merged 1 commit into
stagingfrom
fix/prism-core-order
Jun 29, 2026
Merged

fix(prism): load prismjs core before language components#5262
waleedlatif1 merged 1 commit into
stagingfrom
fix/prism-core-order

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

Fixes Prism is not defined on the home (Chat) and workflow-editor pages after the @sim/emcn extraction.

prismjs language components (prismjs/components/prism-*) register on the global Prism that prismjs core installs. Importing a component before core throws Prism is not defined — in SSR and the client. The extraction changed bundling so core no longer loaded eagerly first, exposing a latent bad import order.

  • chat-content.tsx: import prismjs core first (it needs ts/bash/css/markup, which emcn does not register).
  • code-editor.tsx, input-format.tsx, code.tsx: drop the redundant prism-json/prism-python imports — these highlight via emcn's languages, which already registers js/json/python in the correct order.

Follow-up to #5261 (the sideEffects change was necessary but not sufficient — the real cause was import order).

Type of Change

  • Bug fix

Testing

  • Verified on a running build: Prism is not defined is gone on Chat, Logs, and the workflow editor.
  • Comprehensive sweep confirms every source file importing a prismjs language component now loads core first; the three editor files no longer import them at all.

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)

prismjs language components (prismjs/components/prism-*) register on the global Prism that core installs; importing a component before core throws 'Prism is not defined' (in SSR and the client). The @sim/emcn extraction changed bundling so core no longer loaded eagerly first, exposing the latent bad order on the home (chat-content) and workflow-editor pages.

- chat-content.tsx: import prismjs core first (it needs ts/bash/css/markup, which emcn does not register).
- code-editor.tsx, input-format.tsx, code.tsx: drop the redundant prism-json/prism-python imports — these highlight via emcn's languages, which already registers js/json/python in the correct order.
@vercel

vercel Bot commented Jun 29, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jun 29, 2026 5:08pm

Request Review

@cursor

cursor Bot commented Jun 29, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Import-order and cleanup only; no auth, data, or highlighting logic changes beyond fixing the runtime error.

Overview
Fixes Prism is not defined on Chat and workflow editor surfaces after @sim/emcn changed how Prism is bundled. Language plugins must run after prismjs core creates the global Prism registry.

chat-content.tsx now imports prismjs core before its extra language components (typescript, bash, css, markup) that Chat markdown needs but emcn does not register.

code.tsx, input-format.tsx, and tool-input/code-editor.tsx drop direct prism-json / prism-python imports and rely on emcn’s highlight / languages, which already register js, json, and python in the right order via packages/emcn/src/components/code/prism.ts.

Reviewed by Cursor Bugbot for commit 420b475. Configure here.

@greptile-apps

greptile-apps Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes Prism loading for chat and editor highlighting. The main changes are:

  • Loads Prism core before chat language components.
  • Removes duplicate Python grammar registration from the workflow code editor.
  • Removes duplicate JSON grammar registration from input format and tool-input editors.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/home/components/message-content/components/chat-content/chat-content.tsx Adds Prism core before the chat language component imports.
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/code/code.tsx Removes a duplicate Python Prism component import while keeping shared highlighting from @sim/emcn.
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/starter/input-format.tsx Removes a duplicate JSON Prism component import while keeping shared JSON highlighting.
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/components/code-editor/code-editor.tsx Removes a duplicate JSON Prism component import from the tool-input code editor.

Reviews (1): Last reviewed commit: "fix(prism): load prismjs core before lan..." | Re-trigger Greptile

@waleedlatif1 waleedlatif1 merged commit 56f9393 into staging Jun 29, 2026
16 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/prism-core-order branch June 30, 2026 04:23
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