MCPcopy Create free account
hub / github.com/caseywebdev/react-list / componentDidUpdate

Method componentDidUpdate

src/react-list.js:131–151  ·  view source on GitHub ↗
(prevProps)

Source from the content-addressed store, hash-verified

129 }
130
131 componentDidUpdate(prevProps) {
132 // Viewport scroll is no longer useful if axis changes
133 if (this.props.axis !== prevProps.axis) this.clearSizeCache();
134
135 // If the list has reached an unstable state, prevent an infinite loop.
136 if (this.unstable) return;
137
138 if (++this.updateCounter > MAX_SYNC_UPDATES) {
139 this.unstable = true;
140 return console.error(UNSTABLE_MESSAGE);
141 }
142
143 if (!this.updateCounterTimeoutId) {
144 this.updateCounterTimeoutId = setTimeout(() => {
145 this.updateCounter = 0;
146 delete this.updateCounterTimeoutId;
147 }, 0);
148 }
149
150 this.updateFrame();
151 }
152
153 maybeSetState(b, cb) {
154 if (isEqualSubset(this.state, b)) return cb();

Callers 2

index.jsFile · 0.80

Calls 2

clearSizeCacheMethod · 0.95
updateFrameMethod · 0.95

Tested by

no test coverage detected