Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Builder generator includes width on Columns components #1687

Merged
merged 4 commits into from
Feb 13, 2025

Conversation

liamdebeasi
Copy link
Contributor

@liamdebeasi liamdebeasi commented Feb 13, 2025

Description

The Builder generator does not include the width values when going from Mitosis --> Builder. This results in column objects with in the Columns component having the wrong size. See results from the test pushed to this branch:

Input

{
  data: {
    blocks: [
      {
        '@type': '@builder.io/sdk:Element',
        component: {
          name: 'Columns',
          options: {
            columns: [{ blocks: [], width: 50 }, { blocks: [] }],
          },
        },
      },
    ],
  },
}

Results

 FAIL  src/__tests__/builder.test.ts > Builder > map Column widths
Error: Snapshot `Builder > map Column widths 1` mismatched

- Expected
+ Received

  {
    "data": {
      "blocks": [
        {
          "@type": "@builder.io/sdk:Element",
          "actions": {},
          "bindings": {},
          "children": [],
          "code": {
            "actions": {},
            "bindings": {},
          },
          "component": {
            "name": "Columns",
            "options": {
              "columns": [
                {
                  "blocks": [],
-                 "width": 50,
                },
                {
                  "blocks": [],
                },
              ],
            },
          },
        },
      ],
      "jsCode": "",
      "tsCode": "",
    },
  }

This PR fixes the issue by ensuring that the width is preserved when generating column objects in Columns Builder elements.

Make sure to follow the PR preparation steps in CONTRIBUTING.md before submitting your PR:

  • format the codebase: from the root, run yarn fmt:prettier.
  • update all snapshots (in core & CLI): from the root, run yarn test:update
  • add Changeset entry: from the root, run yarn g:changeset and follow the CLI instructions. Alternatively, use the Changeset Github Bot to create the file.

Copy link

changeset-bot bot commented Feb 13, 2025

🦋 Changeset detected

Latest commit: 16f7cb9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@builder.io/mitosis Patch
@builder.io/mitosis-cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

nx-cloud bot commented Feb 13, 2025

View your CI Pipeline Execution ↗ for commit 16f7cb9.

Command Status Duration Result
nx e2e @builder.io/e2e-app ✅ Succeeded 1m 3s View ↗
nx run-many --target test ✅ Succeeded 4m 39s View ↗
nx run-many --target build --exclude @builder.i... ✅ Succeeded 3m 48s View ↗
nx build @builder.io/mitosis-site ✅ Succeeded 2m 26s View ↗

☁️ Nx Cloud last updated this comment at 2025-02-13 19:10:53 UTC

@liamdebeasi liamdebeasi changed the title add failing test fix: Builder generator includes with on Column Feb 13, 2025
@liamdebeasi liamdebeasi changed the title fix: Builder generator includes with on Column fix: Builder generator includes with on Column components Feb 13, 2025
@liamdebeasi liamdebeasi marked this pull request as ready for review February 13, 2025 19:04
@liamdebeasi liamdebeasi changed the title fix: Builder generator includes with on Column components fix: Builder generator includes width on Columns components Feb 13, 2025
@liamdebeasi liamdebeasi merged commit 469394f into BuilderIO:main Feb 13, 2025
7 checks passed
@liamdebeasi liamdebeasi deleted the ld/column-value branch February 13, 2025 19:15
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.

2 participants