Plotly.Blazor icon indicating copy to clipboard operation
Plotly.Blazor copied to clipboard

Issue updating to 4.2.0

Open jewicht opened this issue 1 year ago • 2 comments

Hello,

I'm trying to update from 4.1.0 and 4.2.0. The only modifications was to bump Plotly.Blazor in the solution and remove the javascripts in _Layout.cshtml.

I get the following exception:

blazor.server.js:1 [2024-03-20T14:59:50.541Z] Error: Microsoft.JSInterop.JSException: Could not find 'newPlot' ('newPlot' was undefined).
Error: Could not find 'newPlot' ('newPlot' was undefined).
    at http://localhost:5123/_framework/blazor.server.js:1:734
    at Array.forEach (<anonymous>)
    at l.findFunction (http://localhost:5123/_framework/blazor.server.js:1:702)
    at _ (http://localhost:5123/_framework/blazor.server.js:1:5445)
    at http://localhost:5123/_framework/blazor.server.js:1:3238
    at new Promise (<anonymous>)
    at y.beginInvokeJSFromDotNet (http://localhost:5123/_framework/blazor.server.js:1:3201)
    at Xt._invokeClientMethod (http://localhost:5123/_framework/blazor.server.js:1:61001)
    at Xt._processIncomingData (http://localhost:5123/_framework/blazor.server.js:1:58476)
    at Xt.connection.onreceive (http://localhost:5123/_framework/blazor.server.js:1:52117)
   at Microsoft.JSInterop.JSObjectReferenceExtensions.InvokeVoidAsync(IJSObjectReference jsObjectReference, String identifier, CancellationToken cancellationToken, Object[] args)
   at Plotly.Blazor.PlotlyJsInterop.NewPlot(CancellationToken cancellationToken)
   at Plotly.Blazor.PlotlyChart.NewPlot(CancellationToken cancellationToken)
   at Plotly.Blazor.PlotlyChart.OnAfterRenderAsync(Boolean firstRender)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)

Any idea why this newPlot function is not found?

jewicht avatar Mar 20 '24 15:03 jewicht

Yeah, its the browser cache. The examples are using the previous version and overwrite the newest version everytime. Will update the examples sooner or later. You may want to use the examples using a different browser or a private window.

Use the browser dev tools (Network > Disable Cache)

sean-mcl avatar Mar 20 '24 15:03 sean-mcl

Thanks, that indeed fixes the issue.

jewicht avatar Mar 20 '24 15:03 jewicht

I'm still having the problem with 4.3.0. Clearing the browser cache does the trick but I don't want to inform all the users of my app to clear their cache. so we're still on 4.1.0. How to properly fix it?

jewicht avatar Jun 04 '24 12:06 jewicht

I'm still having the problem with 4.3.0. Clearing the browser cache does the trick but I don't want to inform all the users of my app to clear their cache. so we're still on 4.1.0. How to properly fix it?

Will check it out next week. I thought about a solution by appending the version number of plotly and the interop scripts to the file names, so it automatically reloads the JS without disabling the cache.

sean-mcl avatar Jun 13 '24 10:06 sean-mcl

Should be fixed by https://github.com/LayTec-AG/Plotly.Blazor/pull/432

sean-mcl avatar Jun 17 '24 12:06 sean-mcl

Indeed, it's fixed, thanks

jewicht avatar Jun 17 '24 14:06 jewicht