Skip to content

Commit ba6c1c2

Browse files
committed
wip: consolidate css virual invalidate to addWatchFile
1 parent a7b26f5 commit ba6c1c2

1 file changed

Lines changed: 19 additions & 16 deletions

File tree

packages/plugin-rsc/src/plugin.ts

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -758,22 +758,22 @@ export default function vitePluginRsc(
758758
// with the pre-edit href
759759
// JS importers (inner.tsx, server.tsx, ...) are left alone — only
760760
// the derived CSS virtual needs recomputing
761-
const visited = new Set<string>()
762-
const walk = (mod: EnvironmentModuleNode) => {
763-
if (!mod.id || visited.has(mod.id)) return
764-
visited.add(mod.id)
765-
if (mod.id.startsWith('\0virtual:vite-rsc/css?')) {
766-
this.environment.moduleGraph.invalidateModule(mod)
767-
}
768-
for (const imp of mod.importers) {
769-
walk(imp)
770-
}
771-
}
772-
for (const mod of ctx.modules) {
773-
for (const imp of mod.importers) {
774-
walk(imp)
775-
}
776-
}
761+
// const visited = new Set<string>()
762+
// const walk = (mod: EnvironmentModuleNode) => {
763+
// if (!mod.id || visited.has(mod.id)) return
764+
// visited.add(mod.id)
765+
// if (mod.id.startsWith('\0virtual:vite-rsc/css?')) {
766+
// this.environment.moduleGraph.invalidateModule(mod)
767+
// }
768+
// for (const imp of mod.importers) {
769+
// walk(imp)
770+
// }
771+
// }
772+
// for (const mod of ctx.modules) {
773+
// for (const imp of mod.importers) {
774+
// walk(imp)
775+
// }
776+
// }
777777
}
778778
}
779779

@@ -2291,6 +2291,9 @@ function vitePluginRscCss(
22912291
for (const next of mod?.importedModules ?? []) {
22922292
if (next.id) {
22932293
if (isCSSRequest(next.id)) {
2294+
if (next.file) {
2295+
visitedFiles.add(next.file)
2296+
}
22942297
if (hasSpecialCssQuery(next.id)) {
22952298
continue
22962299
}

0 commit comments

Comments
 (0)