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

Feature: "Load Control" optimisation #1

Merged
merged 12 commits into from
Apr 4, 2020

Conversation

devonChurch
Copy link
Owner

What 👋

Addresses a performance issue where throttling the HEX update would often loose the final change event causing the native color <input /> and the <Swatch /> UI to become out of sync.

Where 🔍

This can be seen by clicking on a <Swatch /> and "aggressively" stacking update sequences before finishing your color selection. This causes the final swatch selection to be missed by the throttle timeout.

Why 🤔

Users deserve a snappy experience and for their selections to be represented accurately within the UI.

How 💡

The 3rd party Lodash Throttle and Debounce dependencies were removed and a custom optimization currently called "Load Control" was created.

This was a React specific integration (although it can be used with vanilla JS too) built around hooks and combines Throttle and Debounce systems within the same system.

"Load Control" allows for spreading the load when dragging the color range slider while still catching the final <input /> change to keep the UI in sync.

Note 📋

I also integrated the "Load Control" into other areas of the application where a Lodash solution was previously in effect:

  • Swatch Scrolling
  • Swatch Dragging

Demo 📺

Before 👎 🙁

The final color change is NOT caught causing the native UI to show red while the application UI shows blue

throttle-before

After 👍 🙂

Both native and application UI are now in sync, even when "aggressively" dragging the color range slider_.

throttle-after

@devonChurch devonChurch added bug Something isn't working enhancement New feature or request labels Apr 4, 2020
@devonChurch devonChurch merged commit bc71f17 into master Apr 4, 2020
@devonChurch devonChurch deleted the feature/throttle-optimisation branch April 4, 2020 22:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant