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

Reactive Forms binding doesn't on production builds #1061

Closed
1 of 2 tasks
ynunez opened this issue Apr 27, 2024 · 2 comments
Closed
1 of 2 tasks

Reactive Forms binding doesn't on production builds #1061

ynunez opened this issue Apr 27, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@ynunez
Copy link

ynunez commented Apr 27, 2024

Please provide the environment you discovered this bug in.

https://github.com/ynunez/analog-reactiveforms-defect

Which area/package is the issue in?

create-analog

Description

When enabling the experimental supportAnalogFormat the form bindings stop working. I created a simple project with a form to demonstrate the problem see the repo URL

After building via npm run build and executing the server via node ./dist/analog/server/index.mjs you'll see the form binding is not working. When you set supportAnalogFormat to false and repeat it works as expected

Please provide the exception or error you saw

No response

Other information

No response

I would be willing to submit a PR to fix this issue

  • Yes
  • No
@ynunez ynunez added the bug Something isn't working label Apr 27, 2024
@brandonroberts
Copy link
Member

This is a known issue. I think it has to do with reactive forms not being fully integrated with OnPush, which is what the SFCs use by default.

@brandonroberts brandonroberts closed this as not planned Won't fix, can't repro, duplicate, stale Jun 22, 2024
@ajitzero
Copy link
Contributor

The workaround for now is essentially to use the async pipe with valueChanges. Or convert the valueChanges stream to a signal.

So either:

import { toSignal } from '@angular/core/rxjs-interop';

profileFormValue$ = this.profileForm.valueChanges.pipe(
  startsWith({}),
);
profileFormValueSignal = toSignal(this.profileFormValue$);
{{ profileFormValue$ | async | json }}
<!-- or: -->
{{ profileFormValueSignal() | json }}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants