Unverified Commit 186d169e authored by Rob Pruzan's avatar Rob Pruzan Committed by GitHub

chore(devtools): sync todos to linear (#81901)

- Sync's scattered todo's with tracked issues in linear
- minor cleanup of old code
parent 78760d3b
......@@ -231,12 +231,7 @@ function DevOverlayRoot({
state,
}}
>
<DevOverlay
// we also pass props for legacy UI
dispatch={dispatch}
state={state}
getSquashedHydrationErrorDetails={getSquashedHydrationErrorDetails}
/>
<DevOverlay />
</DevOverlayContext>
</>
)
......
import type { Meta, StoryObj } from '@storybook/react'
import { NextLogo } from './next-logo'
import { withShadowPortal } from '../../storybook/with-shadow-portal'
// TODO(rob): this storybook's configurability is broken intentionally
// it will be restored when we wrap it in the storybook context addon https://storybook.js.org/addons/storybook-react-context
// TODO: NEXT-4642
const StoryBookNextLogo = (
_: {
issueCount: number
......
......@@ -28,8 +28,7 @@ export const ResizeHandle = ({
left: 0,
})
// TODO(rob): if parallel with >2 sides (user resizes panel to be max width/height)
// then we need to relax disabled resize heuristic
// TODO: NEXT-4645
const shouldShowHandle = () => {
const getOppositeCorner = (corner: Corners): ResizeDirection => {
switch (corner) {
......
......@@ -11,7 +11,6 @@ import {
useStorybookOverlayReducer,
} from './storybook/use-overlay-reducer'
import { DevOverlayContext } from '../dev-overlay.browser'
import { getSquashedHydrationErrorDetails } from '../userspace/pages/hydration-error-state'
const meta: Meta<typeof DevOverlay> = {
component: DevOverlay,
......@@ -54,7 +53,7 @@ export const Default: Story = {
backgroundColor: 'black',
}}
>
{/* TODO: get lots of real hard examples so we have better debug */}
{/* TODO: NEXT-4643 */}
<img
src={imgApp}
style={{
......@@ -71,11 +70,7 @@ export const Default: Story = {
state,
}}
>
<DevOverlay
state={state}
dispatch={dispatch}
getSquashedHydrationErrorDetails={getSquashedHydrationErrorDetails}
/>
<DevOverlay />
</DevOverlayContext>
</div>
)
......@@ -104,11 +99,7 @@ export const WithPanel: Story = {
state,
}}
>
<DevOverlay
dispatch={dispatch}
getSquashedHydrationErrorDetails={getSquashedHydrationErrorDetails}
state={state}
/>
<DevOverlay />
</DevOverlayContext>
</>
)
......
......@@ -6,12 +6,11 @@ import { Colors } from './styles/colors'
import { ErrorOverlay } from './components/errors/error-overlay/error-overlay'
import { RenderError } from './container/runtime-error/render-error'
import { DarkTheme } from './styles/dark-theme'
import type { HydrationErrorState } from '../shared/hydration-error'
import type { ReadyRuntimeError } from './utils/get-error-by-type'
import { DevToolsIndicator } from './components/devtools-indicator/devtools-indicator'
import { PanelRouter } from './menu/panel-router'
import { PanelRouterContext, type PanelStateKind } from './menu/context'
import type { OverlayState, OverlayDispatch } from './shared'
import { useDevOverlayContext } from '../dev-overlay.browser'
export const RenderErrorContext = createContext<{
runtimeErrors: ReadyRuntimeError[]
......@@ -20,17 +19,11 @@ export const RenderErrorContext = createContext<{
export const useRenderErrorContext = () => useContext(RenderErrorContext)
export function DevOverlay({
state,
dispatch,
getSquashedHydrationErrorDetails,
}: {
state: OverlayState
dispatch: OverlayDispatch
getSquashedHydrationErrorDetails: (error: Error) => HydrationErrorState | null
}) {
export function DevOverlay() {
const [panel, setPanel] = useState<null | PanelStateKind>(null)
const [selectedIndex, setSelectedIndex] = useState(-1)
const { state, dispatch, getSquashedHydrationErrorDetails } =
useDevOverlayContext()
const triggerRef = useRef<HTMLButtonElement>(null)
return (
......
......@@ -154,6 +154,7 @@ export const PanelRouter = () => {
<MenuPanel />
</PanelRoute>
{/* TODO: NEXT-4644 */}
<PanelRoute name="preferences">
<DynamicPanel
sharePanelSizeGlobally={false}
......@@ -230,7 +231,6 @@ export const PanelRouter = () => {
<PanelRoute name="turbo-info">
<DynamicPanel
sharePanelSizeGlobally={false}
// this size config is really silly, should calculate initial size dynamically
sizeConfig={{
kind: 'fixed',
height: 470 / state.scale,
......
import { DevOverlay } from '../dev-overlay'
import { DevOverlayContext } from '../../dev-overlay.browser'
import {
useStorybookOverlayReducer,
storybookDefaultOverlayState,
} from './use-overlay-reducer'
import type { OverlayState } from '../shared'
import type { ReadyRuntimeError } from '../utils/get-error-by-type'
type WrapperProps = {
initialState?: Partial<OverlayState>
runtimeErrors?: ReadyRuntimeError[]
children?: never
}
// todo: wrap stories in this so props are configurable
export function DevOverlayStoryWrapper({ initialState }: WrapperProps) {
const mergedState: OverlayState = {
...storybookDefaultOverlayState,
...initialState,
} as OverlayState
const [state, dispatch] = useStorybookOverlayReducer(mergedState)
return (
<DevOverlayContext
value={{ state, dispatch, getSquashedHydrationErrorDetails: () => null }}
>
<DevOverlay
state={state}
dispatch={dispatch}
getSquashedHydrationErrorDetails={() => null}
/>
</DevOverlayContext>
)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment