Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cancel selection by clicking background, and hide action panel #833

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

georgefst
Copy link
Contributor

@georgefst georgefst commented Mar 22, 2023

As mentioned in the commit message, I no longer think the first commit here is a good idea.

But it does at least give us an easy way to cancel a node selection by clicking the background, enabling the disappearing-action-panel behaviour in the second commit*, so I've pushed this branch to allow us to get a feel for that. Although as it happens, I'm not sure that's such a good idea now either. We proposed it during last week's in-person meeting (along with a major redesign of the sidebar), but as @dhess anticipated in yesterday's wrap-up, it actually ends of feeling a bit weird, at least when implemented as naively as this, particularly because a newly-selected node can disappear behind the panel. Further UX exploration is needed.

* Strictly speaking, it's kind-of unrelated, but without this change the panel would only not be present when a new program is created, or when the selected node is deleted.

… manually

This has enough downsides that it's looking like a failed experiment. Overall, my impression is now more strongly that we should use RF for rendering only, rather than utilising its internal state. At which point, we may be able to get away with a much simpler tree/graph-rendering library.

Benefits:
- Original motivation: allows us to click on the background to cancel selection.
- IDs can no longer pass `isNan`, because such nodes have `selectable: false`.
- Slight increase in responsiveness (in theory), since initial selection change is frontend-only.
- Opens a door to easy multi-selection.
- Slightly simplifies `PrimerNode` type def.

Drawbacks/todo:
- The `deepEqual` check stops the obvious infinite loops, but feels like a hack, and I've now noticed some major flickering during edits, where selection goes on and off several times before settling.
- The use of `useNodesState` is taken from examples, and crucial to this working, but docs say not to use it in production (without really saying why, or what to do instead).
- Selecting multiple nodes is now possible (with shift-click and drag). We may not want this. And if we do, we shouldn't be ignoring most of them with `p.onNodeClick(p.nodes[0])`.
- Our `assertType` call is getting complex as we use more and more fields from `RFNode`.
- Several uses of `// @ts-ignore` - use `as` and encapsulate within `ReactFlowSafe`?
- Do we really want to tie ourselves closer to RF anyway? Given that we have some concerns about performance, and other recent work has been done in the opposite direction.
@georgefst georgefst added the Deploy service Deploy the backend service for this PR label Mar 28, 2023
@dhess dhess removed the Deploy service Deploy the backend service for this PR label Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants