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

feat: gray out non-matches when searching #554

Merged
merged 3 commits into from
Feb 13, 2023

Conversation

starpit
Copy link
Contributor

@starpit starpit commented Jan 30, 2023

This PR reduces the saturation (from 60 to 10) for non-matches.

Note: there seems to be a bug in foamtree? It does not redraw some of the nodes until you hover over them. This seems to be a preexisting issue.

Fixes #553

Screenshot 2023-01-30 at 11 00 33 AM

Click to see the outdated details about the .redraw() behavior we've discussed in this PR

FoamTree bug?

This gif shows how randomly some of the nodes are not redrawn (by foamtree) until you hover over them. I think this bug is masked by the current highlighting behavior, which does not change the color of non-matching nodes.
foamtree-oddity

@valscion
Copy link
Member

This gif shows how randomly some of the nodes are not redrawn (by foamtree) until you hover over them. I think this bug is masked by the current highlighting behavior, which does not change the color of non-matching nodes.

Hmm, if this bug wasn't active earlier but is now visible, we will need to fix it before we can ship this feature.

Are you able to debug further on why this happens and if updating our version of FoamTree would help fix the situation?

Ever since #412 we've got FoamTree from an NPM package. I don't recall right now on how updating this package will happen so it needs some thought behind it. Looking through the changelogs of FoamTree could show if this bug has existed on FoamTree side and has now been fixed.

@starpit
Copy link
Contributor Author

starpit commented Jan 31, 2023

Hmm, I don't think FoamTree is open source? I don't even see a way to file an issue. You are using the latest version (3.5.0).

@valscion
Copy link
Member

Yeah FoamTree is not open source but they do distribute it via npm

@starpit
Copy link
Contributor Author

starpit commented Jan 31, 2023

Interesting. If i change the .redraw(false, groupsToRedraw) to .redraw(), then the bug goes away. So either: a) the groupsToRedraw computation is incorrect on your side; or b) foamtree does not handle this properly.

Is it viable to work around this for now by always redrawing all groups, i.e. .redraw()?


Edit: Thinking this through more: if the highlight groups changes (which is where this redraw() is called)... then with this PR, we will always be redrawing almost all of the chunks... since the colors are likely to change for almost all groups, when the search term changes.

I have updated the PR along these lines.

@valscion
Copy link
Member

valscion commented Feb 1, 2023

Thanks for looking more into why this case happened 😊. I'm not that familiar with the treemap interaction code so it is very helpful to have you figure this out, too.

It sounds like the original code could've used the false argument as some sort of render optimization. Is the rendering now noticeably slower than it used to be? I wonder if we need to somehow have some sort of a debounce for the handling of search input value changes if redrawing the treemap becomes slow.

This PR reduces the saturation (from 60 to 10) for non-matches.

Fixes webpack-contrib#553
@starpit
Copy link
Contributor Author

starpit commented Feb 2, 2023

the false of .redraw(false) is the default behavior. it tells foamtree not to animate the update. the second argument is a hint to foamtree as to which groups may have changed. the bug is either in bundle analyzer's presentation of changed groups to foamtree, or in foamtree's algorithm that interprets this hint.

i have not noticed any rendering lag for the example above, which has maybe 100 top-level groups, and 600 total groups.

@valscion
Copy link
Member

valscion commented Feb 3, 2023

Okay thanks for the extra information!

That sounds like a useful optimization to have. I suspect that operation is costly so with users having even more groups and maybe a less powerful machine could get performance issues they weren't seeing earlier.

However, we are indeed debouncing changes done to the search input here:

handleValueChange = _.debounce((event) => {
this.informChange(event.target.value);
}, 400)

so maybe the performance issue wouldn't be that bad. I don't know what other code paths call to this method that now calls .redraw()? I hope none related to cursor movements or some other commonly used events.

Copy link
Member

@valscion valscion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I took this for a spin, too, and even with a CPU slowdown of 6x I can't see any performance issues with this code.

Thank you for the contribution, this looks ace! I'll create a changelog entry for this and merge after ☺️

@valscion valscion merged commit f959f9c into webpack-contrib:master Feb 13, 2023
@valscion
Copy link
Member

This is now in v4.8.0! 🚀

crapStone pushed a commit to Calciumdibromid/CaBr2 that referenced this pull request Feb 14, 2023
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [webpack-bundle-analyzer](https://github.com/webpack-contrib/webpack-bundle-analyzer) | devDependencies | minor | [`4.7.0` -> `4.8.0`](https://renovatebot.com/diffs/npm/webpack-bundle-analyzer/4.7.0/4.8.0) |

---

### Release Notes

<details>
<summary>webpack-contrib/webpack-bundle-analyzer</summary>

### [`v4.8.0`](https://github.com/webpack-contrib/webpack-bundle-analyzer/blob/HEAD/CHANGELOG.md#&#8203;480)

[Compare Source](webpack-contrib/webpack-bundle-analyzer@v4.7.0...v4.8.0)

-   **Improvement**
    -   Support reading large (>500MB) stats.json files ([#&#8203;423](webpack-contrib/webpack-bundle-analyzer#423) by [@&#8203;henry-alakazhang](https://github.com/henry-alakazhang))
    -   Improve search UX by graying out non-matches ([#&#8203;554](webpack-contrib/webpack-bundle-analyzer#554) by [@&#8203;starpit](https://github.com/starpit))

-   **Internal**
    -   Add Node.js v16.x to CI and update GitHub actions ([#&#8203;539](webpack-contrib/webpack-bundle-analyzer#539) by [@&#8203;amareshsm](https://github.com/amareshsm))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [x] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4xMzMuMCIsInVwZGF0ZWRJblZlciI6IjM0LjEzMy4wIn0=-->

Co-authored-by: cabr2-bot <cabr2.help@gmail.com>
Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1783
Reviewed-by: Epsilon_02 <epsilon_02@noreply.codeberg.org>
Co-authored-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
Co-committed-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
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.

Search should gray out non-matches?
2 participants