Workiva / Workiva/over_react

UIP-3018 ResizeSensor intermittent null error in _reset

Open
#136 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Dart
Stars
432
Forks
57
PR merge metrics
No merged PRs in 30d

Description

  • Issue Type: BUG

We're seeing stacktraces sometimes originating from ResizeSensor:

resize_sensor.dart ResizeSensorComponent._reset 
resize_sensor.dart ResizeSensorComponent.componentDidMount.<anonymous function> 
resize_sensor.dart _SafeAnimationFrameMixin.requestAnimationFrame.<anonymous function> 

message: Uncaught exception: NullError: x is null

One potential cause of this is that _reset is being called after the component is unmounted, with the unmount taking place during the animation frame delay.

We should add a _isMounted check inside _reset to hopefully fix this.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in resize_sensor.dart at ResizeSensorComponent._reset and the componentDidMount animation-frame callback. Check the unmount path and verify that _reset does not access null state after unmount; done means the reported NullError no longer occurs in that scenario.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, react
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.