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

🐞 - TuiError produce an error with PolymorpheusComponent #7525

Closed
2 of 9 tasks
EricPoul opened this issue May 22, 2024 · 9 comments
Closed
2 of 9 tasks

🐞 - TuiError produce an error with PolymorpheusComponent #7525

EricPoul opened this issue May 22, 2024 · 9 comments
Labels
bug Something isn't working

Comments

@EricPoul
Copy link

Playground Link

https://stackblitz.com/edit/angular-mwny1a?file=src%2Fapp%2Fapp.component.ts,src%2Fapp%2Fapp.component.html,src%2Fapp%2Fapp.module.ts&hideExplorer=1

Description

When I provide the TUI_VALIDATION_ERRORS object with PolymorpheusComponent as a value in it an error occurs Error: Cannot create a proxy with a non-object as target or handler. It's because required error has true value here. Also, I haven't seen any examples with components on the Taiga.ui and this issue hadn't been faced with before but since TUI_VALIDATION_ERRORS allows PolymorpheusContent I'm expecting it works properly with PolymorpheusComponent.

Angular version

12.2.17

Taiga UI version

3.79.0

Which browsers have you used?

  • Chrome
  • Firefox
  • Safari
  • Edge

Which operating systems have you used?

  • macOS
  • Windows
  • Linux
  • iOS
  • Android
@EricPoul EricPoul added bug Something isn't working state: need triage labels May 22, 2024
@waterplea
Copy link
Collaborator

Looks like the only way to fix it would be to wrap primitive values into objects, but that would be breaking change 🤔

@EricPoul
Copy link
Author

It can be wrapped only for components and templates but if it didn't work before could it be considered as a breaking change?😄

@waterplea
Copy link
Collaborator

If we manage to do it only for components and templates — it won't be breaking :)

@EricPoul
Copy link
Author

I see that it could be for component only since template examples works https://github.com/taiga-family/ng-polymorpheus/blob/main/projects/ng-polymorpheus/src/directives/outlet.ts#L65

@waterplea
Copy link
Collaborator

It would work but you won't be able to get value of the error since templates can only access keys of the context object:

<ng-template #tmp let-value="key">{{ value }}</ng-template>

@EricPoul
Copy link
Author

EricPoul commented May 22, 2024

Yep, so the goal is to try to wrap a primitive into the object for templates and components? It shouldn't be a breaking change for templates since it didn't work properly before(did work only if you hadn't reached a context). Is it a priority bug for you or should I consider making a PR?

@waterplea
Copy link
Collaborator

We are currently working very hard to finish 4.0 so this won't be on our radar for a while. You can think on the fix in the meantime. I wonder if it's better to fix it in polymorpheus so it works everywhere. Current main in polymorpheus is the upcoming major release, fyi.

@hakimio
Copy link
Contributor

hakimio commented May 31, 2024

Why not just use @ngneat/error-tailor and avoid the tui-error boilerplate altogether?

@waterplea
Copy link
Collaborator

Moving it to ng-polymorpheus: taiga-family/ng-polymorpheus#449

@waterplea waterplea closed this as not planned Won't fix, can't repro, duplicate, stale Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

3 participants