-
-
Notifications
You must be signed in to change notification settings - Fork 488
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
Display reasons why module was included #85
Conversation
bfb13db
to
70df018
Compare
Hi! Thanks for submitting this PR 😊. Sorry for replying a bit late — I've been thinking about this PR for quite some time and figuring out a good response. First of all, I really like this feature. I think it brings a lot of additional value that was previously quite inaccessible. The size of this PR is quite heavy, though, so reviewing this code would take quite a big amount of time. There are a few factors why I haven't been able to review this properly as of yet:
All of these make it a bit more challenging to jump into this PR. However, I really do think that this feature would be a good addition. I hope I'm able to shed some light into why this is a bit difficult PR to review. Do you have any suggestions into how we could make this a bit simpler for me to look through? |
Thanks for replying!
No worries, I can split them up I think. Always a bit of a guess whether commits should be squashed or not.
Understood. If it's necessary I can add some UI tests but it will greatly increase the surface of the PR :).
I think you're referring to ModulesTreemap? That is getting quite big indeed. I can refactor, but same issue here as well - increases the surface of the PR.
Could you elaborate a bit on why you think this is an issue?
As far as the last question, I can split it up into smaller commits, and provide a technical overview of the PR (I've basically only described the feature now). I think refactoring and/or adding tests will only make it more difficult to get reviewed/merged. The UI code is still quite simple. Before I put it in the effort it's probably a good idea to settle on whether this is the way forward. It's been extremely helpful for me the last few days in figuring out why things end up in our bundle. Maybe we can collect some more feedback before making a decision. I can do a write-up on Medium and ask people to test-drive it. |
It just makes it a bit more difficult to review and test the implications of this and assert that I have figured out the data flow correctly for it. Compared to just looking at I definitely don't mean that it's a bad thing that this feature leverages |
Would saving the hash to state on hashchange (`setState({ hash:
window.location.hash })`, and inferring the selectedModule in `render()`,
rather than imperatively updating state with `selectedModule`, help?
…On Wed, Jun 7, 2017 at 9:18 AM Vesa Laakso ***@***.***> wrote:
This feature brings in a secondary, global state container — the
window.location.hash.
Could you elaborate a bit on why you think this is an issue?
It just makes it a bit more difficult to review and test the implications
of this and assert that I have figured out the data flow correctly for it.
Compared to just looking at this.state and this.props, this is just a bit
more to take in at once.
I definitely don't mean that it's a bad thing that this feature leverages
window.location.hash. It just adds a dash more complexity :)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#85 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAVh3LDy_6xFqwcxbpXz6d63SMxg5XF5ks5sBk68gaJpZM4NvTHy>
.
|
Yeah, I don't know about other people but I find it easier to read large-ish PRs with one step at a time, and should I want to squash things, I could do it at merge-time :)
I'd be curious to hear what @th0r feels about this feature. I do think that this is a very good addition to the plugin. I think it's just about maintenance burden on this one, not necessarily whether people wouldn't consider this a good addition.
That could definitely improve things. If we're able to move global hash accessing to the edges of the components and use state & props, it would be great. I wouldn't even mind if we'd have a separate wrapper component in between that would only handle the integration with
Yeah, that is a tough place to be in. Do you think we could iterate on a good testing strategy outside of this PR? For example, creating a new PR that starts from this branch so we would be able to look at figuring out a good test strategy outside of this new feature addition? |
Hi guys! @dgieselaar Thanks for a great PR! Information about reasons is definitely the next big thing I want to add to this module and I even have some working code already. The main problem here is the clean intuitive and convenient UI. Here are my thoughts on UI requirements:
And here are possible solutions:
The blind spot here is moving back to original active module, but I think it can be solved with @dgieselaar's approach that uses browser history. What do you think guys? |
Hi @th0r! I think these are the only differences between your list of requirements and my implementation:
Other than that, the drilldown, and navigating back and forth etc, should work. Have you tried it out? |
Not sure here. IMO zooming is a quite frequent operation (for me at least) especially in a large project. And I don't think showing module details are going to be used more frequently. And the second concern is we will change default behavior. P.S. Double-click to zoom doesn't work for me in your branch (Macbook, touchpad).
I'm not sure we need to zoom in but moving into viewport and highlighting is a must-have.
Yes, I tried but didn't get what moving back and forth does. Seems line nothing changes in the UI.
Also you use the same left sidebar. I was talking about adding the right one to show details about active module. |
Alright. How about zooming in on a selected module? A compromise :). If not acceptable, how would you prefer the user to select a module, double click?
Will investigate.
When you say highlight, do you mean the same behaviour as on hover, namely the module lighting up a bit?
When you say moving back and forth, do you mean navigating back and forth between URLs? If so, it should select the module based on the hash in the URL. Is this not happening for you?
Fair point! Do you think that it's better to have separate sidebars? Personally, I develop in split-screen mode, so my browser window is more tablet size, and having two sidebars take up a lot of horizontal space would make things quite hard to use. |
Double click (but seems like it has some issues) or cmd/ctrl + click
I would change outline color to something noticeable.
It changes URL in the browser, the value in the search and found modules. But how it helps to figure out module reasons?
Actually, when you selecting a module there is no point in showing left sidebar - only right sidebar will be visible with details module information in it. |
The module reasons are displayed below the selected module. Might be a bug somewhere, could you make a screenshot? |
Haha, well, that explains, a bug indeed. Seems like the names don't correspond. Could you send me the stats file? |
Thanks! Will report back later.
…On Thu, Jun 8, 2017 at 10:41 AM Yuriy Grunin ***@***.***> wrote:
https://www.dropbox.com/s/qdm8abmu179pnom/stats.json?dl=0
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#85 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAVh3O4IUxCaXl32DvFJqtBYLCb72gzEks5sB7OegaJpZM4NvTHy>
.
|
Sorry, completely forgot about this! Moving it back to the top of my list :). |
Hi @th0r, I made the following changes:
I've not yet created a second sidebar. Can you try this out first and tell me what changes you'd like to see based on this? |
Hi! Thanks for continuing work on this PR :) I'd like you to know that we haven't forgotten about this PR. It's just that this has lots of new changes, and we don't have any proper UI tests, that adding new features to the UI is starting to be much more scary maintainability-wise. Would you happen to have any ideas on how we could possibly add even rudimentary UI tests for this? |
hi, guys, I did something similar https://github.com/restrry/webpack-deps-tree what do you think about integrating that tool in |
Once we have #32 done, that visualization could be a new reporter that you could develop outside of this repo :) But let's not hijack this PR to discuss this, though |
Hi @dgieselaar, sorry for dragging this PR out for so long! The idea behind this PR is amazing, and would definitely be useful to have in some form. However, with the upcoming version 3, I'm afraid we can't continue with this PR as it currently is. Hopefully in the future it will be simpler to experiment with new analysis tools and extra information. Right now, I'm concerned of the merge conflicts we'd have should we try to get this in before version 3. I'll close this PR as there doesn't currently seem to be a way to get this in. Thank you for contributing, it has been a pleasure talking this idea through and I hope we'll see some version of this idea later in the future 💞 |
No problem, thanks for notifying me! I hope I can pick it up soon when I
have some time available.
…On Sun, Feb 4, 2018, 11:16 Vesa Laakso ***@***.***> wrote:
Hi @dgieselaar <https://github.com/dgieselaar>, sorry for dragging this
PR out for so long! The idea behind this PR is amazing, and would
definitely be useful to have in some form.
However, with the upcoming version 3, I'm afraid we can't continue with
this PR as it currently is. Hopefully in the future it will be simpler to
experiment with new analysis tools and extra information. Right now, I'm
concerned of the merge conflicts we'd have should we try to get this in
before version 3.
I'll close this PR as there doesn't currently seem to be a way to get this
in. Thank you for contributing, it has been a pleasure talking this idea
through and I hope we'll see some version of this idea later in the future
💞
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#85 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAVh3C0ytcPBjIEggZPinu5imdpU27xAks5tRYN_gaJpZM4NvTHy>
.
|
Let's see how the code landscape looks like when I get v3 finished up. It might be a good idea to wait for v3 first before opening up this code again |
FYI @dgieselaar, v3 has been released! |
The version 3 I talked about 8 months ago didn't go so well and I had to scrap my PR. The other version 3 that was released is something else |
Displaying import reasons is what I'm working on right now so expect it to be landed in the next version. |
First of all, thanks for a wonderful tool! It has been super helpful in our attempts to reduce the bundle size of our main application.
One of the things that was slightly difficult for me though is figuring out why stuff was in the bundle. I started using the
reasons
metadata instats.json
to trace back the origins, but it's quite cumbersome to grep a JSON file. I thought it would be helpful to have this in the UI as well.Here's what the change does:
Search for modules.
The user is a presented with an input field in the sidebar, which will allow them to filter a list of modules in the bundle.
Display the reasons a module was included
For every module, the reasons why it was included in the displayed in the module info block. The weird CSS you see in ModuleButton is used to fake a text-overflow from the start rather than the end, because the latter part of the module's path is more identifying than the first few folders.
Adds the concept of selected modules.
This allows the user to select or pin a module, and have its info displayed in the sidebar. There are three ways to select a module:
Once a module is selected,
window.location.hash
is updated with the id of the module. If the user has selected a module group rather than a module, the name of the module is prefilled in the input field to allow the user to search for modules in that group.The user can deselect a module by clicking on the close button of the sidebar, or they can use a back button that is displayed to go the previously selected module or query. They can also just use browser navigation to quickly navigate back and forth between selected modules. This allows the user to quickly do drill-downs of reasons why modules were included.