Skip to content

Commit

Permalink
WIP manual
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Mar 21, 2024
1 parent 3a9540c commit c57c320
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
4 changes: 4 additions & 0 deletions packages/next/src/client/components/layout-router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ function walkAddRefetch(
}

return treeToRecreate
// @ts-expect-error FIXME: `findDOMNode` was removed in React 19.
}
// @ts-expect-error FIXME: `findDOMNode` was removed in React 19.

// TODO-APP: Replace with new React API for finding dom nodes without a `ref` when available
/**
Expand All @@ -98,11 +100,13 @@ function findDOMNode(
// Only apply strict mode warning when not in production
if (process.env.NODE_ENV !== 'production') {
const originalConsoleError = console.error
// @ts-expect-error FIXME: `findDOMNode` was removed in React 19.
try {
console.error = (...messages) => {
// Ignore strict mode warning for the findDomNode call below
if (!messages[0].includes('Warning: %s is deprecated in StrictMode.')) {
originalConsoleError(...messages)
// @ts-expect-error FIXME: `findDOMNode` was removed in React 19.
}
}
return ReactDOM.findDOMNode(instance)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const INITIAL_OVERLAY_STATE: OverlayState = {
}

export function useErrorOverlayReducer() {
return useReducer<React.Reducer<OverlayState, BusEvent>>((_state, action) => {
return useReducer((_state: OverlayState, action: BusEvent): OverlayState => {
switch (action.type) {
case ACTION_BUILD_OK: {
return { ..._state, buildError: null }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -524,8 +524,10 @@ function createPendingCacheNode(

// Create a deferred promise. This will be fulfilled once the dynamic
// response is received from the server.
rsc: createDeferredRsc(),
head: isLeafSegment ? createDeferredRsc() : null,
// TODO: Double check why we need to type-cast here.
// It's likely some conflict between the bounded `ReactNode = AwaitedReactNode | Promise<AwaitedReactNode>` and the unbounded `Promise<ReactNode>`
rsc: createDeferredRsc() as React.ReactNode,
head: isLeafSegment ? (createDeferredRsc() as React.ReactNode) : null,
lazyDataResolved: false,
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,10 @@ export const routeModule = new PagesRouteModule({
App,
Document,
},
// @ts-expect-error Actual type error.
// `userland` does not specify any props it'll pass.
// But `moduleError` is a component where the `statusCode` prop is required.
// Either `statusCode` needs to be optional or `PagesRouteModule` needs to ensure via types that it'll somewher inject to require props
// e.g. by saying it accepts components with any props not components with no props i.e. {}.
userland: moduleError,
})

0 comments on commit c57c320

Please sign in to comment.