You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d39e9f2
Browse filesBrowse the repository at this point in the historyBrowse files
fix(diff): resolve a code field's language from either version
A removed block's language exists only in the base version, and an empty
saved language short-circuited the lookup, so both fell back to JavaScript
or to no highlighting. The language now comes from the target values, then
the base values, then the field default, through a Map so only the listed
languages can match.
Copy file name to clipboardExpand all lines: apps/sim/app/workspace/[workspaceId]/w/components/workflow-diff/components/change-list/field-change-row.tsx
+19-17Lines changed: 19 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -26,31 +26,33 @@ import type { SubBlockConfig } from '@/blocks/types'
26
26
import{formatParameterLabel}from'@/tools/params'
27
27
28
28
/** Code languages blocks offer, as the highlighter names them. */
29
-
constCODE_DIFF_LANGUAGES: Record<string,string>={
30
-
javascript:'javascript',
31
-
typescript:'typescript',
32
-
python:'python',
33
-
shell:'bash',
34
-
json:'json',
35
-
}
29
+
constCODE_DIFF_LANGUAGES=newMap([
30
+
['javascript','javascript'],
31
+
['typescript','typescript'],
32
+
['python','python'],
33
+
['shell','bash'],
34
+
['json','json'],
35
+
])
36
36
37
37
/**
38
-
* The syntax a text diff highlights as: JSON for structured values, a code field's language
39
-
* (the block's own `language` setting first, as the editor does), and plain text for prose.
38
+
* The syntax a text diff highlights as: JSON for structured values, plain text for prose, and
39
+
* for code the first language that names one the highlighter knows: the block's `language`
40
+
* setting after the change, then before it (a removed block has only that), then the field's
0 commit comments