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

speed up time to switch edit or select modes on large designs, by changing css classes on strands and strand parts outside of React/Redux for efficiency, and pulling edit/select mode information out of view components to decrease re-rendering time when edit/select modes change #370

Closed
dave-doty opened this issue Jul 11, 2020 · 3 comments
Assignees
Labels
enhancement New feature or request high priority Something cruicial to get working soon.

Comments

@dave-doty
Copy link
Member

dave-doty commented Jul 11, 2020

Currently, changing the edit or select mode re-renders every Strand React component and every subcomponent, because all of them take the AppUIState's Edit modes and Select modes as props. They do this so that they know whether to add the classes "selectable" and "selected", which indicates to the CSS file how to style them on mouseover (e.g., making them "glow" or turn pink).

This is immensely slow on large designs to switch between edit modes or select modes.

This is an instance where it is probably best for efficiency to side-step React and have the state change trigger a middleware that reaches directly into the DOM to change these classes.

It is also necessary to add middleware (mode_sensitive_actions_filter_middleware) to help discard/transform certain actions, because the view components now do not have enough information to know whether an action is permissible to dispatch, or what type of action to create (e.g., when clicking on a domain, are we in select mode to select the strand? in nick mode to nick the domain?)

@dave-doty dave-doty added enhancement New feature or request high priority Something cruicial to get working soon. labels Jul 11, 2020
@dave-doty dave-doty self-assigned this Jul 11, 2020
@dave-doty
Copy link
Member Author

This might come in handy for this: https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleSheet/insertRule

@dave-doty dave-doty changed the title speed up time to swtich edit or select modes on large designs, by changing css classes on strands and strand parts outside of React/Redux for efficiency speed up time to switch edit or select modes on large designs, by changing css classes on strands and strand parts outside of React/Redux for efficiency Jul 12, 2020
@dave-doty
Copy link
Member Author

This will also require extensive re-engineering of the way edit modes are handled. Currently, the onClick handlers for different parts of Strands access the full edit mode to decide what to do (e.g., if in Nick edit mode, then clicking on a Domain nicks it).

This can be handled by making the click handlers dumb. They should just package up information about the click (e.g., what offset on the domain was clicked), and let middleware handle the logic of looking up the edit mode and deciding what to do.

@dave-doty dave-doty changed the title speed up time to switch edit or select modes on large designs, by changing css classes on strands and strand parts outside of React/Redux for efficiency speed up time to switch edit or select modes on large designs, by changing css classes on strands and strand parts outside of React/Redux for efficiency, and pulling edit/select mode information out of view components to decrease re-rendering time when edit/select modes change Jul 15, 2020
@dave-doty
Copy link
Member Author

Closed in #377.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request high priority Something cruicial to get working soon.
Projects
None yet
Development

No branches or pull requests

1 participant