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

Microsoft.JSInterop.JSException: Couldn't find the editor with id: entity-view editors.length: 0 #133

Open
FLAMESpl opened this issue Jun 3, 2024 · 5 comments

Comments

@FLAMESpl
Copy link

FLAMESpl commented Jun 3, 2024

I cannot set value to code editor, I am getting this exception: Microsoft.JSInterop.JSException: Couldn't find the editor with id: entity-view editors.length: 0

I am declaring code editor like this:

                <StandaloneCodeEditor @ref="codeEditor"
                                      Id="entity-view"
                                      ConstructionOptions="GetConstructionOptions"/>

and setting value like this:

        await codeEditor.SetValue(args.Json);
@cwevers
Copy link

cwevers commented Jun 15, 2024

Same here

@leigh-pointer
Copy link

@FLAMESpl try setting the value in AfterRender, then you can be pretty sure the interop is loaded.

@FLAMESpl
Copy link
Author

It is assigned on button click after I stay on a page for few minutes.

@burtonrodman
Copy link

burtonrodman commented Jun 24, 2024

I am having same issue. In my situation, I am using a Blazor WebAssembly project and I have a page that I visit multiple times to edit the details of an item. If I use ConstructionOptions, the value is set on the first instantiation, but then remains the same in subsequent visits to the page -- even though I see the OnInitializedAsync and OnParametersSetAsync get called and I am getting the correct parameters, loading the data and updating the models -- The editor never gets re-initialized with the new value.

If I remove the Value from the ConstructionOptions and try to set it in OnAfterRenderAsync, I get the error (regardless of firstRender).

any suggestions would be appreciated.

@burtonrodman
Copy link

I was able to resolve the issue by setting Value to a single space in the ContructionOptions, and also handle OnDidInit to set the value via SetValue method after my data was loaded.

This seems like a bug on 2 points...

  • Calling SetValue after initialization when ConstructionOptions.Value is empty throws the error
  • Visiting a page containing the editor doesn't refresh the value when provided by ConstructionOptions.

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

No branches or pull requests

4 participants