Error when opening a confirm dialog after making a dropdown selection. #684

Closed
opened 2026-01-29 17:41:34 +00:00 by claunia · 2 comments
Owner

Originally created by @groogiam on GitHub (Dec 16, 2022).

Describe the bug
I am randomly getting this error when showing a confirm dialog using the following code.

public async Task<bool> ShowConfirmDialog(string message, string title= "Confirm")
    {
        var retval = await DialogService.Confirm(message, title, new ConfirmOptions
        {
            OkButtonText = "Ok",
            CancelButtonText = "Cancel",
            ShowClose = false
        });

        return retval == true;
    }
crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
      Unhandled exception rendering component: Cannot read properties of undefined (reading 'target')
      TypeError: Cannot read properties of undefined (reading 'target')
          at Radzen.closeAllPopups (https://localhost:51992/_content/Radzen.Blazor/Radzen.Blazor.js:840:38)
          at Object.openDialog (https://localhost:51992/_content/Radzen.Blazor/Radzen.Blazor.js:947:16)
          at https://localhost:51992/_framework/blazor.webassembly.js:1:3332
          at new Promise (<anonymous>)
          at Object.beginInvokeJSFromDotNet (https://localhost:51992/_framework/blazor.webassembly.js:1:3306)
          at Object.St [as invokeJSFromDotNet] (https://localhost:51992/_framework/blazor.webassembly.js:1:59960)
          at _mono_wasm_invoke_js_blazor (https://localhost:51992/_framework/dotnet.6.0.12.qkxds61loa.js:1:195300)
          at wasm://wasm/00971d3e:wasm-function[219]:0x1a492
          at wasm://wasm/00971d3e:wasm-function[167]:0xce60
          at wasm://wasm/00971d3e:wasm-function[166]:0xbd73
Microsoft.JSInterop.JSException: Cannot read properties of undefined (reading 'target')
TypeError: Cannot read properties of undefined (reading 'target')
    at Radzen.closeAllPopups (https://localhost:51992/_content/Radzen.Blazor/Radzen.Blazor.js:840:38)
    at Object.openDialog (https://localhost:51992/_content/Radzen.Blazor/Radzen.Blazor.js:947:16)
    at https://localhost:51992/_framework/blazor.webassembly.js:1:3332
    at new Promise (<anonymous>)
    at Object.beginInvokeJSFromDotNet (https://localhost:51992/_framework/blazor.webassembly.js:1:3306)
    at Object.St [as invokeJSFromDotNet] (https://localhost:51992/_framework/blazor.webassembly.js:1:59960)
    at _mono_wasm_invoke_js_blazor (https://localhost:51992/_framework/dotnet.6.0.12.qkxds61loa.js:1:195300)
    at wasm://wasm/00971d3e:wasm-function[219]:0x1a492
    at wasm://wasm/00971d3e:wasm-function[167]:0xce60
    at wasm://wasm/00971d3e:wasm-function[166]:0xbd73
   at Microsoft.JSInterop.JSRuntime.<InvokeAsync>d__16`1[[System.String, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()
   at Radzen.Blazor.Rendering.DialogContainer.OnAfterRenderAsync(Boolean firstRender)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)

To Reproduce
Steps to reproduce the behavior:

This seems to happen after changing a radzen dropdown value then clicking on a radzen button that calls the above code.

Alternatively link your repo with a sample project that can be run.

Expected behavior
Showing a confirm box should not result in an unhandled exception.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Windows 10 and 11
  • Browser Chrome 108
  • Radzen 4.4.6
    Additional context
    Add any other context about the problem here.
Originally created by @groogiam on GitHub (Dec 16, 2022). <!-- IMPORTANT: Read this first!!! 1. If you own a Radzen Professional or Еnterprise subscription you can report your issue or ask us a question via email at info@radzen.com. Radzen staff will reply within 24 hours (Professional) or 16 hours (Enterprise) 2. The Radzen staff guarantees a response to issues in this repo only to paid subscribers. 3. If you have a HOW TO question start a new forum thread in the Radzen Community forum: https://forum.radzen.com. Radzen staff will close issues that are HOWTO questions. 4. Please adhere to the issue template. Specify all the steps required to reproduce the issue or link a project which reproduces it easily (without requiring extra steps such as restoring a database). --> **Describe the bug** I am randomly getting this error when showing a confirm dialog using the following code. ```csharp public async Task<bool> ShowConfirmDialog(string message, string title= "Confirm") { var retval = await DialogService.Confirm(message, title, new ConfirmOptions { OkButtonText = "Ok", CancelButtonText = "Cancel", ShowClose = false }); return retval == true; } ``` ``` crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] Unhandled exception rendering component: Cannot read properties of undefined (reading 'target') TypeError: Cannot read properties of undefined (reading 'target') at Radzen.closeAllPopups (https://localhost:51992/_content/Radzen.Blazor/Radzen.Blazor.js:840:38) at Object.openDialog (https://localhost:51992/_content/Radzen.Blazor/Radzen.Blazor.js:947:16) at https://localhost:51992/_framework/blazor.webassembly.js:1:3332 at new Promise (<anonymous>) at Object.beginInvokeJSFromDotNet (https://localhost:51992/_framework/blazor.webassembly.js:1:3306) at Object.St [as invokeJSFromDotNet] (https://localhost:51992/_framework/blazor.webassembly.js:1:59960) at _mono_wasm_invoke_js_blazor (https://localhost:51992/_framework/dotnet.6.0.12.qkxds61loa.js:1:195300) at wasm://wasm/00971d3e:wasm-function[219]:0x1a492 at wasm://wasm/00971d3e:wasm-function[167]:0xce60 at wasm://wasm/00971d3e:wasm-function[166]:0xbd73 Microsoft.JSInterop.JSException: Cannot read properties of undefined (reading 'target') TypeError: Cannot read properties of undefined (reading 'target') at Radzen.closeAllPopups (https://localhost:51992/_content/Radzen.Blazor/Radzen.Blazor.js:840:38) at Object.openDialog (https://localhost:51992/_content/Radzen.Blazor/Radzen.Blazor.js:947:16) at https://localhost:51992/_framework/blazor.webassembly.js:1:3332 at new Promise (<anonymous>) at Object.beginInvokeJSFromDotNet (https://localhost:51992/_framework/blazor.webassembly.js:1:3306) at Object.St [as invokeJSFromDotNet] (https://localhost:51992/_framework/blazor.webassembly.js:1:59960) at _mono_wasm_invoke_js_blazor (https://localhost:51992/_framework/dotnet.6.0.12.qkxds61loa.js:1:195300) at wasm://wasm/00971d3e:wasm-function[219]:0x1a492 at wasm://wasm/00971d3e:wasm-function[167]:0xce60 at wasm://wasm/00971d3e:wasm-function[166]:0xbd73 at Microsoft.JSInterop.JSRuntime.<InvokeAsync>d__16`1[[System.String, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext() at Radzen.Blazor.Rendering.DialogContainer.OnAfterRenderAsync(Boolean firstRender) at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState) ``` **To Reproduce** Steps to reproduce the behavior: This seems to happen after changing a radzen dropdown value then clicking on a radzen button that calls the above code. Alternatively link your repo with a sample project that can be run. **Expected behavior** Showing a confirm box should not result in an unhandled exception. **Screenshots** If applicable, add screenshots to help explain your problem. **Desktop (please complete the following information):** - OS: Windows 10 and 11 - Browser Chrome 108 - Radzen 4.4.6 **Additional context** Add any other context about the problem here.
Author
Owner

@enchev commented on GitHub (Dec 19, 2022):

I believe that we've fixed this several weeks ago:
80a887b0d0
I'm unable to reproduce such problem on our demos:
image
image

@enchev commented on GitHub (Dec 19, 2022): I believe that we've fixed this several weeks ago: https://github.com/radzenhq/radzen-blazor/commit/80a887b0d0a7cca5cf99561929f199c99f16cb79 I'm unable to reproduce such problem on our demos: ![image](https://user-images.githubusercontent.com/5804953/208367613-1b4245c9-7bb1-4179-90ab-9a190c40cdba.png) ![image](https://user-images.githubusercontent.com/5804953/208367695-9039a8f5-1c2e-45b0-a439-02725f9a2105.png)
Author
Owner

@groogiam commented on GitHub (Dec 19, 2022):

Looks like I had old 4.4.0 script cached in my browser after upgrading to 4.4.6. Its working after forcing the script to update. Thanks for your help.

@groogiam commented on GitHub (Dec 19, 2022): Looks like I had old 4.4.0 script cached in my browser after upgrading to 4.4.6. Its working after forcing the script to update. Thanks for your help.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#684