-
-
Notifications
You must be signed in to change notification settings - Fork 839
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
Extract PostStream state #2160
Extract PostStream state #2160
Conversation
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.
I have some questions about the code and implementation.
Will look more thoroughly once I'm not on mobile.
I'm mostly ok with this solution, but I'm thinking whether it wouldn't make sense to maybe keep the stream as a single class? If we simply made the stream into a non-component class, that has just a It would make for a way simpler diff, and in my opinion this is a valid way to use Mithril (very similar to what I was suggesting with AlertManager or ModalManager). |
d6df661
to
eb52edc
Compare
eb52edc
to
67b6691
Compare
Could you avoid force-pushing during the review phase? It makes it completely impossible to see what was changed since last review 😅 😅 😅 |
Sorry, that was a rebase to avoid conflicts with other merged things. |
67b6691
to
81fa5bc
Compare
*/ | ||
reset(start, end) { | ||
this.visibleStart = start || 0; | ||
this.visibleEnd = this.sanitizeIndex(end || this.constructor.loadCount); |
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.
Since doing a major rewrite, might want to also change visibleEnd to:
this.visibleEnd = this.sanitizeIndex(end || this.constructor.loadCount - 1)
Logic:
Suppose loadCount is 1, visibleStart = 0 and visibleEnd should be the same post 0.
Would need to also adjust all the code that references visibleEnd - I can send you a pull request for that if you want.
I'm really not sure how to handle review on this. The diff is very complicated to read. If it works as before I'd say go ahead and we can always fix stuff later. |
…ernally (and using it would be bad practice), fixing up PostStream
The event is not triggered anymore. This is now handled through the `positionHandler` prop.
...instead of calculating this derived value outside the state class.
In addition, this again avoids writing a state property from outside the state class. I am not 100% sure whether this extra sanitization is necessary, but it seems to be the only place where it is not applied when changing the value of `visibleEnd` (and not safeguarded otherwise), so I erred on the safe side.
- Law of demeter (no need to access discussion through the state) - Less public API surface of the state object
fb04724
to
1a2f952
Compare
c13ff12
to
09c722e
Compare
This is actually relied on already by not passing the parameter in other methods.
It's not clear whether this was intentionally omitted.
fc5eddb
to
d4abf58
Compare
This also avoids a double-fade from the JavaScript code, which was probably introduced in #2160.
* Fix closing the composer with ESC key Regression from #2161. * Remove obsolete method Regression from #2162. * Mark method as protected * Fade in posts in post stream using CSS This also avoids a double-fade from the JavaScript code, which was probably introduced in #2160. * Fix fadeIn for post stream items Co-authored-by: Alexander Skvortsov <sasha.skvortsov109@gmail.com>
* Fix closing the composer with ESC key Regression from #2161. * Remove obsolete method Regression from #2162. * Mark method as protected * Fade in posts in post stream using CSS This also avoids a double-fade from the JavaScript code, which was probably introduced in #2160. * Fix fadeIn for post stream items Co-authored-by: Alexander Skvortsov <sasha.skvortsov109@gmail.com>
Fixes Part of #1821, #2144
Fixes #2001
Fixes #2086
Changes proposed in this pull request:
Extract PostStream state out of PostStream, PostStreamScrubber.
Reviewers should focus on:
Confirmed
composer test
).