Repository navigation
[Canvas] Layout engine integration simplification - #33702
Conversation
|
Pinging @elastic/kibana-canvas |
💚 Build Succeeded |
d9a1689 to
bd3af51
Compare
ace6772 to
7d0f141
Compare
b41778e to
a3688f3
Compare
💚 Build Succeeded |
a3688f3 to
1a4988c
Compare
💚 Build Succeeded |
w33ble
left a comment
There was a problem hiding this comment.
Initial feedback, have not run this yet.
nit: nitpicky stuff you can choose to ignore
Q: question
CR: change requested
also curious if you have plans to slim down the WorkpadPage component in the future, it's a beast now...
There was a problem hiding this comment.
Q: Was this just an oversight in the old code, where selected elements were not cleared?
There was a problem hiding this comment.
In the old code, we cleared the selection via the middleware (I think circuitously, by clearing it in the aero store which then updated back redux) so it just used a different - and simpler - mechanism there. But glad you asked because:
I'm not proposing this for this PR, but adding this line (and similar ones) made me ponder if our currently fairly lean reducers should be able to do more. For example, here, we issue four dispatches. combineReducers is nice when state slices are truly independent, but it's not possible to implement a new version of setPage that would also vacate the transient.selectedToplevelNodes array. I'm biased toward one user action = one Redux action (sans async stuff like server response) and the Redux doc has a pertinent note on combineReducers.
There was a problem hiding this comment.
I also prefer to lean towards the 1:1 user action to redux action route.
Would it make sense to update the transientReducer to be watching for any of these "page changed" type actions (add, set, delete, duplicate, etc) and set the selectedTopLevelNodes state to empty array? Rather than having to always dispatch this selectTopLevelNodes action when any kind of page change happens?
if (action is changePage or deletePage or addPage)
selectedTopLevelElements = []
There was a problem hiding this comment.
That's probably the better "redux" way, having the transient reducer update based on these actions. So that dispatching only setWorkpad or setPage does what you want without needing to dispatch other actions all the time.
There's a lot of other places we could clean up like that too.
Yes, agreed! Should I put the wrappers around the (already split) |
I'm not sure the best way to spit it up, and personally would not do it in this PR anyway. Was just curious if you had future plans. Sounds like yes, which is good enough for me. |
There was a problem hiding this comment.
Minor: If the page being removed is not the one that's currently the interactive one, then the selections are still reset.
1a4988c to
49f95b4
Compare
💚 Build Succeeded |
w33ble
left a comment
There was a problem hiding this comment.
LGTM. It would be nice if you removed all the added dispatch(selectToplevelNodes([])) and put that logic in the transient reducer, but I'm not going to block on that.
💚 Build Succeeded |
* Refactor: layout engine integration
💚 Build Succeeded |
* Refactor: layout engine integration
Goals:
aeroelastic_kibana.jsthat herds a set of layout stores*Elements->*Nodeswhere appropriate; old PR feedback from @w33ble )Side effects:
shouldUpdate)Non-goals for this specific PR:
Progress:
aero.commitfunction no longer has the callback function arg and the meta argintegration_utils.jsfetchAllRenderables)mw/aeroelastic.jsandaeroelastic_kibana.js) got removedsimplified, esp. the removal of the commit callback and the unification of the logic before next()layoutPropsfunction is temporarily super verbose, got to do that stuff with a few calls to already existing functions, just copy-pasted initiallyFix: deleting the last existing page that has at least one element throws (cloneNode) - related to the aboveindependent issue, see [Canvas] Deleting the last extant page of a workbook throws #34458Fix: grouping outside the Canvas page paper while holding the mouse button breaksindependent issue, see Fix: don't attempt grouping while mouse is down #34448