1- import { MAX_SIGNED_31_BIT_INT } from "../const/CExpirationTime.js" ;
21import { pop , push } from "../fiber/fiberStack.js" ;
32import { markWorkInProgressReceivedUpdate } from "../work/beginWork.js" ;
43import createContextItem from "./constructor/contextItem.js" ;
54import contextCore from "./core/contextCore.js" ;
65// TODO: import { isPrimaryRenderer } from "react-dom";
7- // ReactDOMHostConfig에서 isPrimaryRenderer를 가져옵니다.
6+ // RFS의 ReactDOMHostConfig에서 isPrimaryRenderer를 가져옵니다.
87
98/**
109 *
@@ -25,12 +24,10 @@ const pushProvider = (providerFiber, nextValue) => {
2524 push ( contextCore . valueCursor , context . _currentValue , providerFiber ) ;
2625
2726 context . _currentValue = nextValue ;
28- context . _currentRenderer = contextCore . rendererSigil ;
2927 } else {
3028 push ( contextCore . valueCursor , context . _currentValue2 , providerFiber ) ;
3129
3230 context . _currentValue2 = nextValue ;
33- context . _currentRenderer2 = contextCore . rendererSigil ;
3431 }
3532} ;
3633
@@ -102,7 +99,7 @@ const scheduleWorkOnParentPath = (parent, renderExpirationTime) => {
10299 * // 이때 변경되었다는 것을 알리는 용도로 해당 fiber의 expirationTime을 변경합니다.
103100 * @returns
104101 */
105- const propagateContextChange = ( workInProgress , context , changedBits , renderExpirationTime ) => {
102+ const propagateContextChange = ( workInProgress , context , renderExpirationTime ) => {
106103 let fiber = workInProgress . child ;
107104 if ( fiber !== null ) {
108105 // Set the return pointer of the child to the work-in-progress fiber.
@@ -122,14 +119,9 @@ const propagateContextChange = (workInProgress, context, changedBits, renderExpi
122119 // Check if the context matches.
123120 // 현재 fiber의 context list중에서 현재 변경된 context와 일치하는 context가 있는지 확인합니다.
124121 // 만약에 일치하면서 변경되었다면 해당 fiber를 re-render해야합니다.
125- if ( dependency . context === context && ( dependency . observedBits & changedBits ) !== 0 ) {
122+ if ( dependency . context === context ) {
126123 // Match! Schedule an update on this fiber.
127124
128- if ( fiber . tag === ClassComponent ) {
129- // NOTE: we don't implement ClassComponent.
130- // 저희는 함수형 컴포넌트만 사용하기 때문에 해당 부분은 구현하지 않습니다.
131- }
132-
133125 // fiber를 re-render하기 때문에 해당 fiber의 expirationTime을 변경합니다.
134126 if ( fiber . expirationTime < renderExpirationTime ) {
135127 fiber . expirationTime = renderExpirationTime ;
@@ -161,12 +153,10 @@ const propagateContextChange = (workInProgress, context, changedBits, renderExpi
161153 } else if ( fiber . tag === ContextProvider ) {
162154 // Don't scan deeper if this is a matching provider
163155 nextFiber = fiber . type === workInProgress . type ? null : fiber . child ;
164- } else if ( fiber . tag === DehydreatedFragment ) {
165- // NOTE: we don't implement DehydreatedFragment.
166- // it's server components
167156 } else {
168157 nextFiber = fiber . child ;
169158 }
159+ // NOTE: we don't implement DehydreatedFragment.
170160
171161 // nextFier가 null이라는 것은 더이상 child가 없다는 것.
172162 // 그러면 sibling을 확인하고 그마저도 존재하지 않는다면 parent로 올라갑니다.
@@ -210,7 +200,7 @@ const propagateContextChange = (workInProgress, context, changedBits, renderExpi
210200const prepareToReadContext = ( workInProgress , renderExpirationTime ) => {
211201 contextCore . currentlyRenderingFiber = workInProgress ;
212202 contextCore . lastContextDependency = null ;
213- contextCore . lastContextWithAllBitsObserved = null ;
203+ contextCore . lastFullyObservedContext = null ;
214204
215205 // component는 여러개의 context를 사용할 수 있습니다.
216206 // dependencies는 해당 fiber에서 사용되는 컨텍스트의 리스트입니다.
@@ -234,27 +224,16 @@ const prepareToReadContext = (workInProgress, renderExpirationTime) => {
234224/**
235225 *
236226 * @param {Tcontext } context
237- * @param {number } observedBits
238227 *
239228 * @description - readContext의 목표는 context 값을 읽는 것입니다.
240229 * 이 함수에서 context의 값을 읽습니다.
241230 * @returns
242231 */
243- const readContext = ( context , observedBits ) => {
244- if ( contextCore . lastContextWithAllBitsObserved === context ) {
232+ const readContext = ( context ) => {
233+ if ( contextCore . lastFullyObservedContext === context ) {
245234 // Nothing to do. We already observe everything in this context.
246- } else if ( observedBits === false || observedBits === 0 ) {
247- // Do not observe any updates.
248235 } else {
249- let resolvedObservedBits ;
250- if ( typeof observedBits !== "number" || observedBits === MAX_SIGNED_31_BIT_INT ) {
251- contextCore . lastContextWithAllBitsObserved = context ;
252- resolvedObservedBits = MAX_SIGNED_31_BIT_INT ;
253- } else {
254- resolvedObservedBits = observedBits ;
255- }
256-
257- const contextItem = createContextItem ( context , resolvedObservedBits , null ) ;
236+ const contextItem = createContextItem ( context , null ) ;
258237
259238 if ( contextCore . lastContextDependency === null ) {
260239 // this is the first dependency for this component. Create a new list.
0 commit comments