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

no jquery fixes #123

Closed
wants to merge 18 commits into from
Closed

no jquery fixes #123

wants to merge 18 commits into from

Conversation

latata
Copy link

@latata latata commented Feb 8, 2018

Fixes

  • removing event handlers
  • setting properties for already destroyed components

Copy link
Collaborator

@snewcomer snewcomer left a comment

Choose a reason for hiding this comment

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

Looks like there are some good fixes here!

} else if (entry.intersectionRatio <= 0) { // exiting viewport
set(this, 'viewportEntered', false);
this.trigger('didExitViewport');
if (!this.isDestroyed && !this.isDestroying) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a good catch! I’m guessing you saw this error when trying out this branch?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I see this error now. Nice

_triggerDidScrollDirectionHandler(event) {
const sensitivity = get(this, 'viewportScrollSensitivity') || 1;

this._debouncedEventHandler('_triggerDidScrollDirection', event.currentTarget, sensitivity);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Curious what your thoughts are bw ever.currentTarget vs scrollableArea vs window in detecting scroll direction. Perhaps irrelevant thus this might be a good fix?

Copy link
Author

Choose a reason for hiding this comment

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

scrollableArea property may be null if it's not set in the component where the mixin is used. So I believe currentTarget is the best idea here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@latata If scrollableArea is not defined, then it defaults to window. Did you happen to see in error wrt to this?

@@ -37,6 +37,8 @@ export default Mixin.create({
}, this._buildOptions());

setProperties(this, options);
this._triggerDidScrollDirectionHandler = this._triggerDidScrollDirectionHandler.bind(this);
this._setViewportEnteredHandler = this._setViewportEnteredHandler.bind(this);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This somewhat spreads out the logic wrt to setViewportEntered. What do ou think?

Copy link
Author

Choose a reason for hiding this comment

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

do you have any better idea how to remove handlers?

Copy link
Collaborator

@snewcomer snewcomer left a comment

Choose a reason for hiding this comment

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

@latata Looks like something happened to the commit history. Lmk if you have time to get that fixed! Otherwise one fix I can pull into the upgrade branch right now is the isDestroyed guard.

_triggerDidScrollDirectionHandler(event) {
const sensitivity = get(this, 'viewportScrollSensitivity') || 1;

this._debouncedEventHandler('_triggerDidScrollDirection', event.currentTarget, sensitivity);
Copy link
Collaborator

Choose a reason for hiding this comment

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

@latata If scrollableArea is not defined, then it defaults to window. Did you happen to see in error wrt to this?

@snewcomer snewcomer force-pushed the upgrade branch 2 times, most recently from c20e9b5 to 348e0f9 Compare February 18, 2018 16:18
@Serabe
Copy link

Serabe commented Feb 26, 2018

@latata can you please rebase this branch? Thank you.

@snewcomer
Copy link
Collaborator

Closing this for now. There were some good ideas here so thank you for that 🙏 . Following up in #138

@snewcomer snewcomer closed this Apr 5, 2018
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.

3 participants