Skip to content

Schedule rebuild immediately on scroll to avoid flicker. #65

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

Merged
merged 3 commits into from
Dec 23, 2018

Conversation

jacob314
Copy link
Contributor

Use visibility observers instead of guessing at when visibility changes.
Visibility observers are an almost magic bullet for infinite scrolling on the web so I was able to strip out the mutation observer and window sizing code.
Fixes bug when initially only 4 rows were drawn for the memory view on first load.

Fixes
#64

Fixes flicker part of
#25

Use visibility observers instead of guessing at when visibility changes.
Fixes bug when initially only 4 rows were drawn for the memory view.
@@ -13,7 +14,7 @@ import 'utils.dart';

// TODO(devoncarew): fixed position header

class Table<T> extends Object with SetStateMixin, OnAddedToDomMixin {
class Table<T> extends Object with SetStateMixin {
Copy link
Member

Choose a reason for hiding this comment

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

I believe this was the only use of OnAddedToDomMixin; we should be able to remove that class (and CoreElementOwner as well?).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed. @DanTup feel free to add back OnAddedToDomMixin if you find a case where it is needed. I expect we can manually trigger some dispose calls if there are some lifecycle cases we really care about.

Copy link
Contributor

@DanTup DanTup left a comment

Choose a reason for hiding this comment

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

Neat, I didn't know about this. If it all works the same, this LGTM (I think I added tests for this, but not sure if they run on CI, so may need to be run manually if you didn't already).

It seems like current stable Safari doesn't support it - though tech preview does, so probably not a concern (I don't know what the intention is for browser support here).

lib/tables.dart Outdated
@@ -28,7 +29,8 @@ class Table<T> extends Object with SetStateMixin {
_spacerBeforeVisibleRows = new CoreElement('tr');
_spacerAfterVisibleRows = new CoreElement('tr');

_visibilityObserver = new IntersectionObserver(_visibilityChange);
// TODO(jacobr): remove call to allowInterop once bug in dart:html is fixed.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a GitHub issue for this bug? If so, adding it in a comment would make it easier to check when it can be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For browser support I think we only need to support chrome as we will generally be launching this app directly from the command line. Added
#66
to remind users if they open the devtools with an unsupported browser.

Filed
dart-lang/sdk#35484
to fix dart:html and referenced that bug in my comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The tests for this do run on travis as they broke without the allowInterop call.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, cool - I couldn't remember which ones we'd got working :-)

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