Skip to content

Commit

Permalink
Merge pull request #108 from greglittlefield-wf/batched_redraw_setSta…
Browse files Browse the repository at this point in the history
…te_regression

UIP-2637 Release over_react 1.16.1 (HOTFIX)
  • Loading branch information
leviwith-wf authored Aug 14, 2017
2 parents 6946cbd + 679d358 commit 5c1cfc2
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 3 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# OverReact Changelog

## 1.16.1

> [Complete `1.16.1` Changeset](https://github.com/Workiva/over_react/compare/1.16.0...1.16.1)
__Bug fixes__

* [#108]: Fix case where `setState` and store trigger only result in one `FluxUiComponent` render

## 1.16.0

> [Complete `1.16.0` Changeset](https://github.com/Workiva/over_react/compare/1.15.1...1.16.0)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

```yaml
dependencies:
over_react: "^1.16.0"
over_react: "^1.16.1"
```
2. Add the `over_react` [transformer] to your `pubspec.yaml`.
Expand Down
2 changes: 1 addition & 1 deletion lib/src/component_declaration/flux_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ abstract class _FluxComponentMixin<TProps extends FluxUiProps> implements Batche
});
}

void componentDidUpdate(Map prevProps, Map prevState) {
void componentWillReceiveProps(Map prevProps) {
// Let BatchedRedraws know that this component has redrawn in the current batch
didBatchRedraw = true;
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: over_react
version: 1.16.0
version: 1.16.1
description: A library for building statically-typed React UI components using Dart.
homepage: https://github.com/Workiva/over_react/
authors:
Expand Down
25 changes: 25 additions & 0 deletions test/over_react/component_declaration/flux_component_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,31 @@ void main() {
expect(nested1.renderCount, 3, reason: 'should have rerendered once in response to the store triggering');
expect(nested2.renderCount, 3, reason: 'should have rerendered once in response to the store triggering');
});

test('redraws twice in response to a the component calling setState and a store trigger happening at the same time', () async {
var store = new Store();

TestNestedComponent nested0;

render(
(TestNested()
..store = store
..ref = (ref) { nested0 = ref; }
)()
);
expect(nested0.renderCount, 1, reason: 'setup check: initial render');

nested0.setState({});
store.trigger();
// Two async gaps just to be safe, since we're
// asserting that additional redraws don't happen.
await nextTick();
await nextTick();

expect(nested0.renderCount, 3,
reason: 'should have rerendered once in response to the store triggering'
' and once in response to setState');
});
});
}

Expand Down

0 comments on commit 5c1cfc2

Please sign in to comment.