π - TuiError produce an error with PolymorpheusComponent
EricPoul opened this issue Β· comments
Playground Link
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
Looks like the only way to fix it would be to wrap primitive values into objects, but that would be breaking change π€
It can be wrapped only for components and templates but if it didn't work before could it be considered as a breaking change?π
If we manage to do it only for components and templates β it won't be breaking :)
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
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>
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?
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.
Why not just use @ngneat/error-tailor and avoid the tui-error
boilerplate altogether?
Moving it to ng-polymorpheus: taiga-family/ng-polymorpheus#449