Erros when upgrading Plotly.Blazor from 4.1.0 to 4.2.0

32 views Asked by At

I'm using WPF Blazor Hybrid app and using BlazorWebView for rendering the blazor. I have some JS codes for handling click, hover use cases of Plotly inside a JS function like below.

plot.on('plotly_hover', (data) => {
some codes here
});

This works fine in version 4.1.0. But after upgrading to 4.2.0, I'm getting the below error. As I am new to JS, can someone let me know how to resolve this error.

"@l":"Error","@x":"System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.\r\n ---> Microsoft.JSInterop.JSException: plot.on is not a function\nTypeError: plot.on is not a function at MyAppHelper.subscribeToClickEvent (https://0.0.0.0/_content/MyApp.Module1/js/MyApp.js:14:14)\n at https://0.0.0.0/_framework/blazor.webview.js:1:3050\n at new Promise ()\n at g.beginInvokeJSFromDotNet (https://0.0.0.0/_framework/blazor.webview.js:1:3007)\n at https://0.0.0.0/_framework/blazor.webview.js:1:48020\n at EventTarget. (:7:62)\n at EmbeddedBrowserWebView. (:1:40673)\r\n at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args)\r\n at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime, String identifier, Object[] args)\r\n at MyApp.Module1.HomePage.OnAfterRenderAsync(Boolean firstRender) in D:\MyApp\8\Module1\HomePage.razor.cs:line 125\r\n at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)\r\n at Microsoft.AspNetCore.Components.WebView.IpcSender.<>c__DisplayClass12_0.b__1()\r\n at Microsoft.AspNetCore.Components.WebView.Wpf.WpfDispatcher.InvokeAsync(Action workItem)\r\n at Microsoft.AspNetCore.Components.WebView.Wpf.WpfDispatcher.<>c.<.cctor>b__8_0(Exception exception)\r\n at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)\r\n at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span1 copyOfArgs, BindingFlags invokeAttr)\r\n --- End of inner exception stack trace ---\r\n at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span1 copyOfArgs, BindingFlags invokeAttr)\r\n at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)\r\n at System.Delegate.DynamicInvokeImpl(Object[] args)\r\n at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)\r\n at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)"

0

There are 0 answers