Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow pass onClose to Show method

See original GitHub issue

I’d like to pass onClose to Show method like win forms show dialog It will free programmers from handle subscribe/unsubscribe. Also it useful if any error was thown before unsubscribe Look like that: Modal.Show<MessageDialog>("Dance", parameters, onClose: ShowResult); I have prepared branch with this feature , but I can not push it, seems I have not rights. If you give me right, I will prepare pull request with feature and samples

Also I fixed bug (m.b blazor bug) If I show first modal then in onClose I show second modal with the same component type (but with another text), blazor do not refresh content inside modal window

Like this: Modal.Show<MessageDialog>("Dance", parameters, onClose: ShowResult); then

void ShowResult(ModalResult result)
        var parameters = new ModalParameters();
        parameters.Add("DialogParameters", new MessageDialog.DialogParameters()
            Message = result.Cancelled ? "User calcel process" : result.Data.ToString(),
            Buttons = new MessageDialog.ButtonType[] { MessageDialog.ButtonType.Ok }

        Modal.Show<MessageDialog>("Result", parameters);

to fix that in ModelService I made : var content = new RenderFragment(x => { x.OpenComponent(1, componentType); x.SetKey(Guid.NewGuid()); x.CloseComponent(); }); I added x.SetKey when build render fragment

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

chrissaintycommented, Nov 20, 2019

That’s because you are trying to push directly to the repo and not raising a PR.

You have to fork the repo first and then raise a PR from your fork into this repo. Again, please have a read of the GitHub docs, here is a link to the article on forking.

troepolikcommented, Mar 2, 2020

Yes, If you can implement this API with awaitable result, it will resolve the problem too

Read more comments on GitHub >

github_iconTop Results From Across the Web

reactjs - MUI Dialog - Can't pass onClose to onClick inside ...
It's to avoid passing event props on onClose because your props not accept that event . And remove your useless value parameters:
Read more >
How to Open and Close a React-Bootstrap Modal ...
Pass the show state variable to the show prop of the Modal component to control the modal behavior. In the handleClose() function, set...
Read more >
Build a simple Modal Component with React - Bits and Pieces
If the component that calls Modal does not pass onClose , the Modal won't close as the show state doesn't have any effect....
Read more >
Passing Functions in React with TypeScript
To finish our component, there is a simple getColor method to display a different color and text depending on the state of our...
Read more >
How to create a Modal Component in React from basic ...
At line 10, we pass onClose to <Modal /> and whenever this method is called, the show value will be false and modal...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found