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

UIP-2153: Transition warning sometimes fires when it shouldn't #58

Merged

Conversation

kaanaksoy-wk
Copy link
Contributor

@kaanaksoy-wk kaanaksoy-wk commented Mar 24, 2017

Proposed solution for #57

Ultimate problem:

The newly-added transition warning (UIP-1802),
VALIDATION WARNING: The number of transitions expected to complete have not completed. Something is most likely wrong. fires sometimes when it shouldn't.

For instance, sometimes transitionend events never fire on purpose, such as when the user cancels the transition (think hiding a popover while it's still showing). This results in a warning when it should not.

I also noticed in the code that the timer does not unsubscribe the listener function, which it probably should.

How it was fixed:

  • Create an instance field, _transitionEndTimer, that keeps track of whether a transition timeout has occurred.
  • When a transition is canceled (ie, after hiding a popover while it's still showing), _transitionEndTimer is canceled as well.
  • Make the timer unsubscribe the listener function.

Testing suggestions:

  • Verify that the tests pass.
  • While in Dart checked mode, verify that rapidly clicking the "Pick a date" button twice (on WSD Docs) does not result in a validation warning.

Potential areas of regression:


FYA: @greglittlefield-wf @aaronlademann-wf @jacehensley-wf @clairesarsam-wf @joelleibow-wf

@aviary2-wf
Copy link

Raven

Number of Findings: 0

@codecov-io
Copy link

codecov-io commented Mar 24, 2017

Codecov Report

Merging #58 into master will increase coverage by 0.02%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master      #58      +/-   ##
==========================================
+ Coverage   97.72%   97.73%   +0.02%     
==========================================
  Files          28       28              
  Lines        1356     1363       +7     
==========================================
+ Hits         1325     1332       +7     
  Misses         31       31

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 44acae5...45d699f. Read the comment docs.

complete();
});

_endTransitionSubscription = getTransitionDomNode()?.onTransitionEnd?.skip(skipCount)?.take(1)?.listen((_) {
timer.cancel();

if (_transitionEndTimer != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

There should be a private helper function to do this. Also you can just use a null-aware operator.

void _cancelTransitionEndTimer() {
  _transitionEndTimer?.cancel();
  _transitionEndTimer = null;
}

@jacehensley-wf
Copy link
Contributor

+1

@greglittlefield-wf
Copy link
Contributor

I'm seeing warnings when I shouldn't when double-clicking the datepicker button rapidly when it's already open. 😢

@@ -187,16 +190,19 @@ abstract class AbstractTransitionComponent<T extends AbstractTransitionProps, S
skipCount = 0;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Hm, I wonder if we should just always do the following here:

_cancelTransitionEventListener();
_cancelTransitionEndTimer();

to clean up any previous calls

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@greglittlefield-wf Do you think the extraneous warnings still appearing could be resolved by placing _cancelTransitionEndTimer() at the top of the handlePreShowing method?

I tried it and it seems to work, but I'm not sure if doing this defeats the purpose of the timer in the first place.

Copy link
Contributor

Choose a reason for hiding this comment

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

Potentially, but wouldn't that be accomplishing the same as what I linked above, albeit in a subset of cases?

@greglittlefield-wf
Copy link
Contributor

  • Changes look good
  • Rapidly toggling visibility of a transitioning element does not result in the warning
  • Warning is still logged as expected when CSS transitions are manually disabled, simulating the use-case of the warning

+10

@jacehensley-wf
Copy link
Contributor

+1

@leviwith-wf
Copy link
Contributor

QA +1

  • Testing instruction
  • Dev +1's
  • Dev/QA +10
  • Unit tests created/updated
  • All unit tests pass
  • Rosie ran/Rosie comment displays expected info
  • Dependency Scan Clean

Merging.

@leviwith-wf leviwith-wf merged commit e3ba50e into Workiva:master Mar 31, 2017
greglittlefield-wf added a commit that referenced this pull request Jun 23, 2020
…to-dom-builders

Warn when custom props are forwarded to a dom component
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants