MCPcopy
hub / github.com/nadbm/react-datasheet / componentDidUpdate

Function componentDidUpdate

src/DataCell.js:54–73  ·  view source on GitHub ↗
(prevProps)

Source from the content-addressed store, hash-verified

52 }
53
54 componentDidUpdate (prevProps) {
55 if (initialValue(prevProps) !== initialValue(this.props)) {
56 this.setState({ updated: true })
57 this.timeout = setTimeout(() => this.setState({ updated: false }), 700)
58 }
59 if (this.props.editing === true && prevProps.editing === false) {
60 const value = this.props.clearing ? '' : initialData(this.props)
61 this.setState({ value, reverting: false })
62 }
63
64 if (
65 prevProps.editing === true &&
66 this.props.editing === false &&
67 !this.state.reverting &&
68 !this.state.committing &&
69 this.state.value !== initialData(this.props)
70 ) {
71 this.props.onChange(this.props.row, this.props.col, this.state.value)
72 }
73 }
74
75 componentWillUnmount () {
76 clearTimeout(this.timeout)

Callers

nothing calls this directly

Calls 2

initialValueFunction · 0.70
initialDataFunction · 0.70

Tested by

no test coverage detected