-
Notifications
You must be signed in to change notification settings - Fork 27.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DevOverlay] Align old and new overlay #74935
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -36,9 +36,7 @@ export function CodeFrame({ stackFrame, codeFrame }: CodeFrameProps) { | |||
.map((line, a) => | ||||
~(a = line.indexOf('|')) | ||||
? line.substring(0, a) + | ||||
line | ||||
.substring(a + 1) | ||||
.replace(`^\\ {${miniLeadingSpacesLength}}`, '') | ||||
line.substring(a).replace(`^\\ {${miniLeadingSpacesLength}}`, '') | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't remove Line 37 in ab87453
|
||||
: line | ||||
) | ||||
.join('\n') | ||||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -100,8 +100,8 @@ export const Terminal: React.FC<TerminalProps> = function Terminal({ | |||||||||||||||||
> | ||||||||||||||||||
<span> | ||||||||||||||||||
<FileIcon /> | ||||||||||||||||||
{getFrameSource(stackFrame)} @{' '} | ||||||||||||||||||
<HotlinkedText text={stackFrame.methodName} /> | ||||||||||||||||||
{getFrameSource(stackFrame)} | ||||||||||||||||||
{/* TODO: Unlike the CodeFrame component, the `methodName` is unavailable. */} | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove unnecessary Lines 75 to 82 in ab87453
|
||||||||||||||||||
</span> | ||||||||||||||||||
<ExternalIcon width={16} height={16} /> | ||||||||||||||||||
</p> | ||||||||||||||||||
|
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -6,7 +6,7 @@ import { Base } from '../internal/styles/base' | |||
import { ComponentStyles } from '../internal/styles/component-styles' | ||||
import { CssReset } from '../internal/styles/css-reset' | ||||
|
||||
import { DevToolsErrorBoundary } from './error-boundary' | ||||
import { DevOverlayErrorBoundary } from './error-boundary' | ||||
import { usePagesReactDevOverlay } from '../../pages/hooks' | ||||
import { Colors } from '../internal/styles/colors' | ||||
import { ErrorOverlay } from '../internal/components/errors/error-overlay/error-overlay' | ||||
|
@@ -20,41 +20,50 @@ interface ReactDevOverlayProps { | |||
} | ||||
|
||||
export default function ReactDevOverlay({ children }: ReactDevOverlayProps) { | ||||
const { isMounted, state, onComponentError, hasRuntimeErrors } = | ||||
usePagesReactDevOverlay() | ||||
|
||||
const [isErrorOverlayOpen, setIsErrorOverlayOpen] = useState(hasRuntimeErrors) | ||||
const { | ||||
isMounted, | ||||
state, | ||||
onComponentError, | ||||
hasRuntimeErrors, | ||||
hasBuildError, | ||||
} = usePagesReactDevOverlay() | ||||
|
||||
const { readyErrors } = useErrorHook({ | ||||
errors: state.errors, | ||||
isAppDir: false, | ||||
}) | ||||
|
||||
const [isErrorOverlayOpen, setIsErrorOverlayOpen] = useState(true) | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Set default value of next.js/packages/next/src/client/components/react-dev-overlay/pages/old-react-dev-overlay.tsx Line 48 in ab87453
|
||||
|
||||
return ( | ||||
<> | ||||
<DevToolsErrorBoundary isMounted={isMounted} onError={onComponentError}> | ||||
<DevOverlayErrorBoundary isMounted={isMounted} onError={onComponentError}> | ||||
{children ?? null} | ||||
</DevToolsErrorBoundary> | ||||
|
||||
<ShadowPortal> | ||||
<CssReset /> | ||||
<Base /> | ||||
<Colors /> | ||||
<ComponentStyles /> | ||||
|
||||
<DevToolsIndicator | ||||
state={state} | ||||
readyErrorsLength={readyErrors.length} | ||||
setIsErrorOverlayOpen={setIsErrorOverlayOpen} | ||||
/> | ||||
|
||||
<ErrorOverlay | ||||
state={state} | ||||
readyErrors={readyErrors} | ||||
isErrorOverlayOpen={isErrorOverlayOpen} | ||||
setIsErrorOverlayOpen={setIsErrorOverlayOpen} | ||||
/> | ||||
</ShadowPortal> | ||||
</DevOverlayErrorBoundary> | ||||
|
||||
{isMounted && ( | ||||
<ShadowPortal> | ||||
<CssReset /> | ||||
<Base /> | ||||
<Colors /> | ||||
<ComponentStyles /> | ||||
|
||||
<DevToolsIndicator | ||||
state={state} | ||||
readyErrorsLength={readyErrors.length} | ||||
setIsErrorOverlayOpen={setIsErrorOverlayOpen} | ||||
/> | ||||
|
||||
{(hasRuntimeErrors || hasBuildError) && ( | ||||
<ErrorOverlay | ||||
state={state} | ||||
readyErrors={readyErrors} | ||||
isErrorOverlayOpen={isErrorOverlayOpen} | ||||
setIsErrorOverlayOpen={setIsErrorOverlayOpen} | ||||
/> | ||||
)} | ||||
</ShadowPortal> | ||||
)} | ||||
</> | ||||
) | ||||
} |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -33,7 +33,7 @@ export function RuntimeError({ error }: RuntimeErrorProps) { | |||||||||||||||||||||||||
? [] | ||||||||||||||||||||||||||
: filteredFrames.slice(0, firstFirstPartyFrameIndex), | ||||||||||||||||||||||||||
trailingCallStackFrames: filteredFrames.slice( | ||||||||||||||||||||||||||
firstFirstPartyFrameIndex + 1 | ||||||||||||||||||||||||||
firstFirstPartyFrameIndex < 0 ? 0 : firstFirstPartyFrameIndex | ||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the old UI, backporting the behavior to include the first first-party call stack frame to be included in the CallStack component. Previously, it was only displayed at the CodeFrame. Lines 12 to 23 in ab87453
|
||||||||||||||||||||||||||
), | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
}, [error.frames, isIgnoredExpanded]) | ||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why we need another flag
__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY
set in CI, shouldn't it just be__NEXT_EXPERIMENTAL_PPR === true
? the variable on nextjs side is all set by define pluginThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
x-ref: #74935 (comment)
__NEXT_EXPERIMENTAL_PPR
is feasible as it's only for testing, but I think explicit__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY
would be better to isolate the condition in case needed.