Skip to content

fix: issues for angular signals api #1750

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

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

nmerget
Copy link
Contributor

@nmerget nmerget commented Apr 14, 2025

Description

Please provide the following information:

Minor fixes for Angular api=signals

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.

@nmerget nmerget requested a review from samijaber as a code owner April 14, 2025 08:22
Copy link

changeset-bot bot commented Apr 14, 2025

🦋 Changeset detected

Latest commit: 02bcfd8

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 Apr 14, 2025

View your CI Pipeline Execution ↗ for commit 02bcfd8.

Command Status Duration Result
nx run-many --target test ✅ Succeeded 5m 10s View ↗
nx e2e @builder.io/e2e-app ✅ Succeeded 1m 9s View ↗
nx run-many --target build --exclude @builder.i... ✅ Succeeded 3m 49s View ↗
nx build @builder.io/mitosis-site ✅ Succeeded 2m 24s View ↗

☁️ Nx Cloud last updated this comment at 2025-05-30 07:21:02 UTC

Comment on lines 2074 to 2112





import { Builder, builder } from '@builder.io/sdk';
import { BuilderBlock as BuilderBlockComponent, BuilderBlocks, get, set } from '@fake';




@Component({
selector: 'form-component',standalone: true,imports: [CommonModule, BuilderBlockComponent, BuilderBlocks],template: \`<form
[attr.validate]=\\"validate()\\"
#formRef
[attr.action]=\\"!sendWithJs() && action()\\"
[attr.method]=\\"method()\\"
[attr.name]=\\"name()\\"
(submit)=\\"onSubmit($event)\\"
#_root
>@if(builderBlock() && builderBlock().children){ @for (block of
builderBlock()?.children;track trackByBlock0(index, block);let index = $index)
{
<builder-block-component
[block]=\\"block\\"
[index]=\\"index\\"
></builder-block-component>
} } @if(submissionState() === 'error'){
<builder-blocks
dataPath=\\"errorMessage\\"
[blocks]=\\"errorMessage()\\"
></builder-blocks>
} @if(submissionState() === 'sending'){
<builder-blocks
dataPath=\\"sendingMessage\\"
[blocks]=\\"sendingMessage()\\"
></builder-blocks>
} @if(submissionState() === 'error' && responseData()){
<pre class=\\"builder-form-error-text pre\\">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nmerget can we please add the htmlWhitespaceSensitivity in ToAngularOptions, this formatting will look a bit odd. It looks like the default is 'css' can we keep this instead of 'ignore' and only format the template? --html-whitespace-sensitivity (defaults to css)https://prettier.io/blog/2018/11/07/1.15.0.html#whitespace-sensitive-formatting

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the default to css but used strict for the templates.

This will ensure that <span> or <a> stay inlined. I add a test to make sure it works.

The downside will be that the template may look a little bit wired sometimes, but I think it shouldn't be a big deal because the generated component will be minified anyways in production. And for debugging you could use your local prettier if it is required.

Copy link
Collaborator

@sidmohanty11 sidmohanty11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apart from the formatting part, this PR LGTM!

# Conflicts:
#	packages/core/src/__tests__/__snapshots__/angular.signals.test.ts.snap
#	packages/core/src/generators/angular/signals/component.ts
#	packages/core/src/generators/angular/signals/helpers/index.ts
@nmerget nmerget requested a review from sidmohanty11 May 30, 2025 07:14
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