Skip to content

Commit

Permalink
Fix bug with outdated callback functions
Browse files Browse the repository at this point in the history
  • Loading branch information
nvonbulow committed Jul 9, 2021
1 parent 711d997 commit c2053e8
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/SpreadsheetStateProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,12 @@ export default class SpreadsheetStateProvider<
}

componentDidMount(): void {
const {
onChange,
onModeChange,
onSelect,
onActivate,
onCellCommit,
} = this.props;
this.unsubscribe = this.store.subscribe(
(state: Types.StoreState<CellType>) => {
const { prevState } = this;
const {
props: { onChange, onModeChange, onSelect, onActivate, onCellCommit },
prevState,
} = this;

if (state.lastCommit && state.lastCommit !== prevState.lastCommit) {
for (const change of state.lastCommit) {
Expand Down

0 comments on commit c2053e8

Please sign in to comment.