Просмотр исходного кода

fix(plugin-manager): ask the runtime which rows the user disabled

The view attributes a disabled row through profileRuntime.userDisables, which
walks the groups holding the entry, and the manager spec stops passing the
runtime option the profile runtime no longer takes.
Yichen Jiang 1 месяц назад
Родитель
Сommit
5694e50548

+ 2 - 2
packages/boot/plugin-manager/src/view.ts

@@ -129,7 +129,6 @@ function packageStatus(facts: {
 /** The rows a composed bundle owns in the live tree, plus rows only the failure registry knows. */
 function composedRows(ctx: Context, runtime: ProfileRuntime, name: string): PluginPackageRowView[] {
   const failures = ctx.get('pluginFailures')
-  const userDisabled = runtime.userDisabledRowIds()
   const rows: PluginPackageRowView[] = []
   const listed = new Set<string>()
   for (const { entry, rowId } of ownedEntries(ctx, runtime, name)) {
@@ -140,7 +139,8 @@ function composedRows(ctx: Context, runtime: ProfileRuntime, name: string): Plug
       rowId,
       moduleName: entry.options.name,
       enabled: !entry.disabled,
-      ...entry.disabled ? { disabledBy: userDisabled.has(rowId) ? 'user' as const : 'composition' as const } : {},
+      // The runtime walks the groups holding the entry: a row inside a group the user disabled is the user's doing.
+      ...entry.disabled ? { disabledBy: runtime.userDisables(entry) ? 'user' as const : 'composition' as const } : {},
       phase: entry.fiber === undefined ? null : ROW_PHASE[entry.fiber.state],
       ...failure === undefined ? {} : { failure: { stage: failure.stage, message: failure.message } },
     })

+ 0 - 1
packages/boot/plugin-manager/tests/plugin-manager.spec.ts

@@ -218,7 +218,6 @@ async function bootProfile(staged: StagedHome, internals: Internals = {}, config
     loadProfile: load,
     compose: composeFor,
     rootEntry: () => rootIncludeEntry(ctx),
-    readUserPatches: () => loadOptionalPatches(NAME, profile.patchPath) ?? [],
   })
   const changes: Booted['changes'] = []
   const log: PluginInstallLogChunk[] = []