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

parsedError can be undefined #50

Open
olegkap opened this issue Mar 3, 2021 · 3 comments
Open

parsedError can be undefined #50

olegkap opened this issue Mar 3, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@olegkap
Copy link

olegkap commented Mar 3, 2021

Hi,

When form with editor is loaded form is marked as dirty.
I did some research and found that in registerEditorListeners method variable hasValidationStatusChanged will resolve to true when control initialized and no changes were made.
This is due to the fact that this.parsedError resolves to undefined and currentParsedError is '' so following line will resolve to true:
const hasValidationStatusChanged = this.parsedError !== currentParsedError;

This causing control to be flagged as modified and when its part of FormGroup it marks the whole form as dirty.

I am using ngx-monaco-editor as follow:
<ngx-monaco-editor [options]="editorOptions" formControlName="queryText" (init)="editorInit($event)"></ngx-monaco-editor>

Is there work around or its by design?

Thanks,
Oleg

@etay-schur-apolicy
Copy link

+1
This is also happening to me every time onMouseLeave event fired
any suggestions?

@jmarc-roy jmarc-roy added the bug Something isn't working label May 16, 2021
@jmarc-roy
Copy link
Collaborator

Hi @etay-schur-apolicy,

Sorry for the late reply. I don't face this issue, when trying to reproduce with angular v12 and latest library version v5.1.0.
Here is a stackblitz link showing the actual behavior: https://stackblitz.com/edit/angular-ogp6rc.

If you still face this issue, please kindly share a reproduction of the bug.

@olegkap
Copy link
Author

olegkap commented May 19, 2021

Hi Geo,

Thanks for looking into it.

I just upgraded to Angular 12 and still facing the issue. (Will try to create reproduceable example later)

I did noticed interesting behavior that occasionally this error doesn't occur in some cases, I think it has to do with text size or some other factor, still trying to figure it out.
Maybe if parsedError would be initialized to '' then error would go away, since eventually it set to '' anyway as initial state?

parsedError: string = '';

Thanks,
Oleg

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