diff --git a/packages/core/src/__tests__/__snapshots__/solid.test.ts.snap b/packages/core/src/__tests__/__snapshots__/solid.test.ts.snap index 4294df4388..3ba87b6095 100644 --- a/packages/core/src/__tests__/__snapshots__/solid.test.ts.snap +++ b/packages/core/src/__tests__/__snapshots__/solid.test.ts.snap @@ -4871,17 +4871,13 @@ function RenderBlock(props) { fallback={ } when={shouldWrap()} > - + @@ -4898,10 +4894,10 @@ function RenderBlock(props) { - + {(child, _index) => { @@ -5150,17 +5146,13 @@ function RenderBlock(props) { fallback={ } when={shouldWrap()} > - + @@ -5177,10 +5169,10 @@ function RenderBlock(props) { - + {(child, _index) => { @@ -10770,17 +10762,13 @@ function RenderBlock(props) { fallback={ } when={shouldWrap()} > - + @@ -10797,10 +10785,10 @@ function RenderBlock(props) { - + {(child, _index) => { @@ -11049,17 +11037,13 @@ function RenderBlock(props) { fallback={ } when={shouldWrap()} > - + @@ -11076,10 +11060,10 @@ function RenderBlock(props) { - + {(child, _index) => { diff --git a/packages/core/src/generators/solid/index.ts b/packages/core/src/generators/solid/index.ts index 5cc09608c5..35743891cc 100644 --- a/packages/core/src/generators/solid/index.ts +++ b/packages/core/src/generators/solid/index.ts @@ -32,7 +32,7 @@ import { CODE_PROCESSOR_PLUGIN } from '../../helpers/plugins/process-code'; import { hasGetContext } from '../helpers/context'; import { blockToSolid } from './blocks'; -// Transform to +// Transform to function processDynamicComponents(json: MitosisComponent, options: ToSolidOptions) { let found = false; traverse(json).forEach((node) => { @@ -118,16 +118,15 @@ export const componentToSolid: TranspilerGenerator> = const componentHasStyles = hasCss(json); const addWrapper = json.children.filter(filterEmptyTextNodes).length !== 1 || options.stylesType === 'style-tag'; + + // we need to run this before we run the code processor plugin, so the dynamic component variables are transformed + const foundDynamicComponents = processDynamicComponents(json, options); + if (options.plugins) { json = runPostJsonPlugins(json, options.plugins); } stripMetaProperties(json); - const foundDynamicComponents = processDynamicComponents(json, options); - const css = - options.stylesType === 'style-tag' && - collectCss(json, { - prefix: hash(json), - }); + const css = options.stylesType === 'style-tag' && collectCss(json, { prefix: hash(json) }); const state = getState({ json, options }); const componentsUsed = getComponentsUsed(json);