react-mosaic icon indicating copy to clipboard operation
react-mosaic copied to clipboard

Get node that was just removed?

Open t3db0t opened this issue 5 years ago • 3 comments
trafficstars

What's the best way to get a node that was just removed (by closing a window)? Right now I'm going to have to manually get a diff from the new layout provided by onChange...

t3db0t avatar Dec 10 '19 20:12 t3db0t

Pass custom toolbarControls to MosaicWindow. You can pass <RemoveButton /> the onClick prop to do what you want.

nomcopter avatar Dec 10 '19 23:12 nomcopter

Sure—however, that would mean two independent callbacks that are hard to collate. I get the onChange with a new layout but with no explicit info about how the layout changed, and then I get the onClick with the info I need.

Thinking out loud, the ideal would be an operational model where onChange returns operations that are performed. Easy for me to say!! If I make that modification I'll send you a PR ;)

Outside of that—is there any other way to force some info into the onChange call?

t3db0t avatar Dec 11 '19 18:12 t3db0t

Not currently, but a second meta arg to onChange would make sense 👍

nomcopter avatar Dec 17 '19 23:12 nomcopter