Closed GoldSucc closed 6 months ago
I have encountered this in version 0.18.3 with NET 8, when navigating away from page with a modal that has previously opened before. The log show different message in both Firefox and Microsoft Edge.
Firefox
Microsoft.JSInterop.JSException: Node.removeChild: Argument 1 is not an object.
[22]</c.delElementFrom@https://localhost:5001/_content/AntDesign/js/ant-design-blazor.js:1:51876
beginInvokeJSFromDotNet/s<@https://localhost:5001/_framework/blazor.server.js:1:3244
beginInvokeJSFromDotNet@https://localhost:5001/_framework/blazor.server.js:1:3201
_invokeClientMethod@https://localhost:5001/_framework/blazor.server.js:1:60713
_processIncomingData@https://localhost:5001/_framework/blazor.server.js:1:58188
Yt/this.connection.onreceive@https://localhost:5001/_framework/blazor.server.js:1:51829
connect/</s.onmessage@https://localhost:5001/_framework/blazor.server.js:1:79974
at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args)
at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime, String identifier, Object[] args)
at AntDesign.AntComponentBase.JsInvokeAsync(String code, Object[] args)
Microsoft Edge
Microsoft.JSInterop.JSException: Failed to execute 'removeChild' on 'Node': parameter 1 is not of type 'Node'.
TypeError: Failed to execute 'removeChild' on 'Node': parameter 1 is not of type 'Node'.
at c.delElementFrom (https://localhost:5001/_content/AntDesign/js/ant-design-blazor.js:1:51876)
at https://localhost:5001/_framework/blazor.server.js:1:3244
at new Promise (<anonymous>)
at y.beginInvokeJSFromDotNet (https://localhost:5001/_framework/blazor.server.js:1:3201)
at Yt._invokeClientMethod (https://localhost:5001/_framework/blazor.server.js:1:60713)
at Yt._processIncomingData (https://localhost:5001/_framework/blazor.server.js:1:58188)
at Yt.connection.onreceive (https://localhost:5001/_framework/blazor.server.js:1:51829)
at s.onmessage (https://localhost:5001/_framework/blazor.server.js:1:79974)
at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args)
at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime, String identifier, Object[] args)
at AntDesign.AntComponentBase.JsInvokeAsync(String code, Object[] args)
@ElderJames I'm very sorry that I don't have time to fix this issue recently.
I think the best solution is to use Element.remove()
instead of this line of code, please evaluate it
In logs navigating out when using modal sometimes produces:
Microsoft.JSInterop.JSException: Argument 1 ('child') to Node.removeChild must be an instance of Node removeChild@[native code] @http://localhost:5082/_content/AntDesign/js/ant-design-blazor.js:1:51887 @http://localhost:5082/_framework/blazor.web.js:1:3244 Promise@[native code] beginInvokeJSFromDotNet@http://localhost:5082/_framework/blazor.web.js:1:3212 @http://localhost:5082/_framework/blazor.web.js:1:62919 _invokeClientMethod@http://localhost:5082/_framework/blazor.web.js:1:63726 _processIncomingData@http://localhost:5082/_framework/blazor.web.js:1:60408 @http://localhost:5082/_framework/blazor.web.js:1:82184 at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args) at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime, String identifier, Object[] args) at AntDesign.AntComponentBase.JsInvokeAsync(String code, Object[] args)
it looks like js code tries to remove modal even if it is not present in dom. good news is that it does not produce any exceptions and don't hang an app but still it is undocumented behaviour. because it happens when navigating away, it probably happens in dispose method of modal. may be js code state does not reflect modal removed from Dom by c# code idk. I haven't checked source code but may be before doing js dispose logic better to send Visible state to js code to update state (not sure if it actually makes sense, depends on how modal is implemented)