diff --git a/.changeset/fluffy-eyes-add.md b/.changeset/fluffy-eyes-add.md new file mode 100644 index 0000000000..b8f02f1215 --- /dev/null +++ b/.changeset/fluffy-eyes-add.md @@ -0,0 +1,5 @@ +--- +'@builder.io/mitosis': patch +--- + +[react]: Changed `defaultProps` generation for react, because defaultProps for function components is deprecated diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 3c6efb9149..8add094731 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -145,3 +145,21 @@ jobs: - name: Run E2E tests run: yarn ci:e2e + + - name: 🆙 Upload test results + if: failure() + uses: actions/upload-artifact@v4 + with: + name: playwright-results + path: ./e2e/e2e-app/test-results + retention-days: 14 + + - name: 🆙 Upload e2e builds + if: failure() + uses: actions/upload-artifact@v4 + with: + name: e2e-builds + path: | + ./e2e/**/dist + !**/node_modules/** + retention-days: 14 diff --git a/e2e/e2e-app/src/component-paths.ts b/e2e/e2e-app/src/component-paths.ts index 11a06ff467..b5c68f7ede 100644 --- a/e2e/e2e-app/src/component-paths.ts +++ b/e2e/e2e-app/src/component-paths.ts @@ -1,4 +1,5 @@ export const COMPONENT_PATHS = [ + '/default-props/', '/one-component/', '/two-components/', '/types/', diff --git a/e2e/e2e-app/src/components/default-props/use-default-props.lite.tsx b/e2e/e2e-app/src/components/default-props/use-default-props.lite.tsx new file mode 100644 index 0000000000..828d588a90 --- /dev/null +++ b/e2e/e2e-app/src/components/default-props/use-default-props.lite.tsx @@ -0,0 +1,18 @@ +import { useDefaultProps, useStore } from '@builder.io/mitosis'; + +useDefaultProps({ foo: 'abc', bar: 'foo' }); + +type DefaultPropsType = { + foo?: string; + bar?: string; +}; + +export default function DefaultProps(props: DefaultPropsType) { + const state = useStore({ + getProps: () => { + return JSON.stringify({ foo: props.foo, bar: props.bar }); + }, + }); + + return
{foo2()}
-{bar()}
-{baz(1)}
-{foo2()}
-{bar()}
-{baz(1)}
-{foo2()}
-{bar()}
-{baz(1)}
-{foo2()}
-{bar()}
-{baz(1)}
-