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

Sometimes not initialized correctly #126

Open
MeikelLP opened this issue Mar 6, 2024 · 2 comments
Open

Sometimes not initialized correctly #126

MeikelLP opened this issue Mar 6, 2024 · 2 comments

Comments

@MeikelLP
Copy link

MeikelLP commented Mar 6, 2024

I'm pretty new to Blazor and am not that good at debugging.

I'm running in rendermode InteractiveServer (otherwise its not working at all).

  • When I navigate to a form that has this editor it doesn't get initialized correctly. There are no errors anywhere
    image
  • When I refresh that page the editor is initialized correctly.
  • When I open another page with other content, the old content is displayed but without CSS (?) instead of a new fresh editor
  • I also tried to set unique IDs for each editor but without success
@obaki102
Copy link

obaki102 commented Apr 5, 2024

I found a workaround. It seems that if you set your render mode on a per-component basis, the necessary JavaScript script files from Monaco are not loaded properly when establishing a web socket connection or when downloading the DLL in WebAssembly mode. That's why you notice a delay and sometimes a full page reload is needed for the text editor to work.

So, in order for it to work, you need to establish a WebSocket connection readily when accessing the page. This can be achieved by setting the render mode globally. In this case, I choose 'InteractiveAuto' and add it to the Routes in the App.razor page.

<Routes @rendermode="InteractiveAuto" />

Finally, I moved all my pages that needs interactivity into the client project, including my layout, and the Routes.razor page.

image

For more info you can check

I believe one drawback of this approach is being limited to 'auto' mode, thus unable to utilize Server-Side Rendering (SSR).

@SSzretter
Copy link

I have this same issue, vs 2002 .net8 webapp project. I using Syncfusion so not sure if that is causing an issue but it looks just like the picture in the first post and when I refresh the width corrects but not the height (I have the stock navigation on the left of the page). To get the height corrected, I had to do this (I couldnt get the css to apply otherwise for some reason):

<StandaloneCodeEditor Id="monaco-editor-instance-id" ConstructionOptions="EditorConstructionOptions" CssClass="min-vh-100" />

When I navigate to the page:

image

If I click refresh on that page:
image

Seems like when the page refreshes its calculating something differently.

First page load:
image

Refresh of page:
image

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

3 participants