Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix dedup
  • Loading branch information
gaojude committed Nov 20, 2024
commit 3a3c800a1a4b74cecc69552fd03803514e592b53
3 changes: 1 addition & 2 deletions packages/next/src/server/app-render/app-render.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import type { LoaderTree } from '../lib/app-dir-module'
import type { AppPageModule } from '../route-modules/app-page/module'
import type {
ClientReferenceManifest,
CssResource,
ManifestNode,
} from '../../build/webpack/plugins/flight-manifest-plugin'
import type { DeepReadonly } from '../../shared/lib/deep-readonly'
Expand Down Expand Up @@ -696,7 +695,7 @@ async function getRSCPayload(
ctx: AppRenderContext,
is404: boolean
): Promise<InitialRSCPayload & { P: React.ReactNode }> {
const injectedCSS = new Set<CssResource>()
const injectedCSS = new Set<string>()
const injectedJS = new Set<string>()
const injectedFontPreloadTags = new Set<string>()
let missingSlots: Set<string> | undefined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { getLinkAndScriptTags } from './get-css-inlined-link-tags'
import type { AppRenderContext } from './app-render'
import { getAssetQueryString } from './get-asset-query-string'
import { encodeURIPath } from '../../shared/lib/encode-uri-path'
import type { CssResource } from '../../build/webpack/plugins/flight-manifest-plugin'
import { renderCssResource } from './render-css-resource'

export async function createComponentStylesAndScripts({
Expand All @@ -16,7 +15,7 @@ export async function createComponentStylesAndScripts({
}: {
filePath: string
getComponent: () => any
injectedCSS: Set<CssResource>
injectedCSS: Set<string>
injectedJS: Set<string>
ctx: AppRenderContext
}): Promise<[React.ComponentType<any>, React.ReactNode, React.ReactNode]> {
Expand Down
5 changes: 2 additions & 3 deletions packages/next/src/server/app-render/create-component-tree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import type { LoadingModuleData } from '../../shared/lib/app-router-context.shar
import type { Params } from '../request/params'
import { workUnitAsyncStorage } from './work-unit-async-storage.external'
import { OUTLET_BOUNDARY_NAME } from '../../lib/metadata/metadata-constants'
import type { CssResource } from '../../build/webpack/plugins/flight-manifest-plugin'

/**
* Use the provided loader tree to create the React Component tree.
Expand All @@ -33,7 +32,7 @@ export function createComponentTree(props: {
parentParams: Params
rootLayoutIncluded: boolean
firstItem?: boolean
injectedCSS: Set<CssResource>
injectedCSS: Set<string>
injectedJS: Set<string>
injectedFontPreloadTags: Set<string>
getMetadataReady: () => Promise<void>
Expand Down Expand Up @@ -81,7 +80,7 @@ async function createComponentTreeInternal({
parentParams: Params
rootLayoutIncluded: boolean
firstItem?: boolean
injectedCSS: Set<CssResource>
injectedCSS: Set<string>
injectedJS: Set<string>
injectedFontPreloadTags: Set<string>
getMetadataReady: () => Promise<void>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type { DeepReadonly } from '../../shared/lib/deep-readonly'
export function getLinkAndScriptTags(
clientReferenceManifest: DeepReadonly<ClientReferenceManifest>,
filePath: string,
injectedCSS: Set<CssResource>,
injectedCSS: Set<string>,
injectedScripts: Set<string>,
collectNewImports?: boolean
): { styles: CssResource[]; scripts: string[] } {
Expand All @@ -24,12 +24,12 @@ export function getLinkAndScriptTags(
clientReferenceManifest.entryJSFiles?.[filePathWithoutExt] ?? []

if (entryCSSFiles) {
for (const file of entryCSSFiles) {
if (!injectedCSS.has(file)) {
for (const css of entryCSSFiles) {
if (!injectedCSS.has(css.path)) {
if (collectNewImports) {
injectedCSS.add(file)
injectedCSS.add(css.path)
}
cssChunks.add(file)
cssChunks.add(css)
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions packages/next/src/server/app-render/get-layer-assets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import type { AppRenderContext } from './app-render'
import { getAssetQueryString } from './get-asset-query-string'
import { encodeURIPath } from '../../shared/lib/encode-uri-path'
import type { PreloadCallbacks } from './types'
import type { CssResource } from '../../build/webpack/plugins/flight-manifest-plugin'
import { renderCssResource } from './render-css-resource'

export function getLayerAssets({
Expand All @@ -17,7 +16,7 @@ export function getLayerAssets({
preloadCallbacks,
}: {
layoutOrPagePath: string | undefined
injectedCSS: Set<CssResource>
injectedCSS: Set<string>
injectedJS: Set<string>
injectedFontPreloadTags: Set<string>
ctx: AppRenderContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
addSearchParamsIfPageSegment,
} from '../../shared/lib/segment'
import { createComponentTree } from './create-component-tree'
import type { CssResource } from '../../build/webpack/plugins/flight-manifest-plugin'

/**
* Use router state to decide at what common layout to render the page.
Expand Down Expand Up @@ -50,7 +49,7 @@ export async function walkTreeWithFlightRouterState({
flightRouterState?: FlightRouterState
parentRendered?: boolean
rscPayloadHead: React.ReactNode
injectedCSS: Set<CssResource>
injectedCSS: Set<string>
injectedJS: Set<string>
injectedFontPreloadTags: Set<string>
rootLayoutIncluded: boolean
Expand Down
Loading