Repository navigation
Conversation
…effect The docs build has been failing at the prerender step with "ReferenceError: useEffect is not defined", so gitbook-pages has not deployed. decolua#1362 removed the `mounted` state and the `mounted &&` guard on createPortal, which was the right call: `modal` is only built when `open` is true, `open` starts false and can only be flipped by a click, so document.body is never touched during SSR. But it left behind the effect that fed that state and switched the react import from useEffect to useLayoutEffect to match it -- while a second useEffect, the one that locks body scroll, was still in the file and lost its import. That leaves two undefined references: useEffect at render, which is what breaks the build, and setMounted inside the surviving effect, which would throw on the client once the import is restored. Deleting the effect finishes what decolua#1362 started rather than reviving state nothing reads. no-undef is not enabled in the repo's eslint config, so lint stays green on the broken file. Enabling it just for this file reports 2 errors on master, 1 if only the import is restored, and 0 here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The docs site has not been deploying.
gitbook-pagesfails onmasterat the prerender step:Why
#1362removed themountedstate and themounted &&guard oncreatePortal. That call was right —modalis only built whenopenis true,openstartsfalseand can only be flipped by a click, sodocument.bodyis never reached during SSR. The guard was redundant.What it missed is that
LanguageSwitcherhad two effects. It deleted the state, kept the effect that fed it, and rewrote the import to match:The second
useEffect— the body-scroll lock, thirty lines further down — was left untouched and lost its import.So there are two undefined references, not one:
useEffect(line 27)setMounted(line 23)Restoring the import alone therefore trades a build failure for a runtime one. The effect has had no state to write since
#1362; deleting it finishes that commit rather than reviving something nothing reads.Verification
Real builds, same tree,
gitbook/:master(eb712ca)ReferenceError: useEffect is not defined, export abortsno-undefis not enabled byeslint-config-next/core-web-vitals, which is why lint has stayed green on a file that cannot render. Turning it on for just this file:no-undefmastersetMounted,useEffectsetMountedNothing else is touched; it is one import and five deleted lines.