-
-
Notifications
You must be signed in to change notification settings - Fork 835
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
Manage Composer height with overridable methods #1272
Conversation
Awesome work! I'm not so sure about extracting this logic into a util class, as there is no use-case for reusability, the purpose is really quite specific to the Composer component – and especially since the logic depends on the Composer's position property, as well as the Composer component's DOM element itself. But I would definitely support having these refactored methods be moved inside of the Composer component 👍 |
Should I move the class into Or should I just implement all these methods as members of |
I personally think directly as members of But maybe we should get a second opinion from @franzliedke :D |
In PHP I'd suggest an interface, but... meh :D |
I moved all my changes back to the Composer class. @tobscure what do you think about dropping the Also this event currently does absolutely nothing, given the window resize does not trigger a new |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job! 👏
Good call, the computed property is probably a case of premature optimization. Let's drop it.
Without the computed property, we should get a different value for |
@clarkwinkelmann status on dropping the computed property? |
@tobscure oops, missed the fact you approved removing it. I'll make the changes soon |
Because the Composer height also depends on the page height and is rarely called without position, height or page height changing anyway
I made the final fixes, and also merged the changes to the Composer from master. The method to get the height to apply is still called PS: as per the contribution guide I didn't commit any change to the dist files, however the dist files from master did change when I merged, but I'll guess you'll take care of recompiling anyway. |
@tobscure Please squash-merge if you're happy with this. |
Thanks for this @clarkwinkelmann, well done. For future reference the contribution guide is out of date and we do prefer committing changes to the dist files. |
This change aims to solve issues I encountered while working on https://github.com/flagrow/mason
With the current implementation it's really hard to change the computation of the default height, as wekk as change the hard-coded minimum height of 200.
This PR separate these concerns into a separate method whose methods can be easily overridden by extensions.
I placed the class in
utils
, not sure if it's the best place.I'm not sure if much performance is actually gained by using a computed property. The
computedHeight
method is only called insideupdateHeight
(my PR changes nothing to that fact), which means it's not called so often.Removing the
computed
call entirely (this means ignoring the second commit of this PR), actually has the benefit of updating the height when the window is resized as well. This prevents the composer from going out of the screen if the browser height is reduced.