@@ -164,20 +164,20 @@ export default function<T, P, I, TI, HI, PI, C, CC, CX, PL>(
164164 ) : void {
165165 switch ( finishedWork . tag ) {
166166 case ClassComponent : {
167- const instance = finishedWork . stateNode ;
168167 if ( finishedWork . effectTag & Snapshot ) {
169168 if ( current !== null ) {
170169 const prevProps = current . memoizedProps ;
171170 const prevState = current . memoizedState ;
172171 startPhaseTimer ( finishedWork , 'getSnapshotBeforeUpdate' ) ;
172+ const instance = finishedWork . stateNode ;
173173 instance . props = finishedWork . memoizedProps ;
174174 instance . state = finishedWork . memoizedState ;
175175 const snapshot = instance . getSnapshotBeforeUpdate (
176176 prevProps ,
177177 prevState ,
178178 ) ;
179179 // TODO Warn about undefined return value
180- current . snapshot = snapshot != null ? snapshot : null ;
180+ instance . __reactInternalSnapshotBeforeUpdate = snapshot ;
181181 stopPhaseTimer ( ) ;
182182 }
183183 }
@@ -222,7 +222,11 @@ export default function<T, P, I, TI, HI, PI, C, CC, CX, PL>(
222222 startPhaseTimer ( finishedWork , 'componentDidUpdate' ) ;
223223 instance . props = finishedWork . memoizedProps ;
224224 instance . state = finishedWork . memoizedState ;
225- instance . componentDidUpdate ( prevProps , prevState , current . snapshot ) ;
225+ instance . componentDidUpdate (
226+ prevProps ,
227+ prevState ,
228+ instance . __reactInternalSnapshotBeforeUpdate ,
229+ ) ;
226230 stopPhaseTimer ( ) ;
227231 }
228232 }
0 commit comments