Skip to content

feat(core): pass panel settings defaults to the devtools UI - #647

Draft
0froq wants to merge 3 commits into
vitejs:mainfrom
0froq:feat/devtools-settings-defaults
Draft

0froq wants to merge 3 commits into
vitejs:mainfrom
0froq:feat/devtools-settings-defaults

Conversation

@0froq

@0froq 0froq commented Nov 21, 2026

Copy link
Copy Markdown

This description was drafted by an agent from the diff and the commands it ran. froQ has reviewed it.

Description

devtools had no way to say what the panel should default to, so a project that wants Mod+K free for its own palette has every developer unbind it by hand. settingsDefaults forwards to createUi({ settingsDefaults }) from @devframes/hub-ui, which resolves the values below each developer's own choice in Settings. A reset in Settings returns to these defaults rather than to the built-in ones.

import { defineConfig } from 'vite'

export default defineConfig({
  devtools: {
    apply: 'serve',
    settingsDefaults: {
      commandShortcuts: {
        // An empty array leaves the command unbound.
        'devframes:toggle-palette': [],
      },
      docksCustomOrder: {
        devframes_plugin_git: -10,
      },
    },
  },
})

commandShortcuts and docksCustomOrder stack per key, so a seeded entry survives one a developer changed themselves. The three dock lists (docksHidden, docksCategoriesHidden, docksPinned) are excluded from the type: the stored list is always present, so a seeded one could never be undone from Settings.

Test

packages/core/src/node/__tests__/ui-settings-defaults.test.ts has two cases, one per hop: createViteDevToolsUi forwards the option to createUi, and createDevToolsPlugins hands it to the server plugin. Both fail on main, where the option is not forwarded:

AssertionError: expected "vi.fn()" to be called with arguments: [ ObjectContaining{…} ]
Number of calls: 1
AssertionError: expected "vi.fn()" to be called with arguments: [ Array(3) ]
Number of calls: 1

createViteDevToolsUi was also checked against a local build of the released-from @devframes/hub-ui: npx tsc --noEmit -p packages/core exits 0 there, which is the only place the new option type matters.

Linked Issues

Related to devframes/devframe#506, which adds the option upstream.

Additional context

This is a draft on purpose. The installed @devframes/hub-ui is 1.3.6, which does not accept settingsDefaults, so packages/core/src/node/ui.ts fails typecheck until that release lands and this branch bumps the catalog to it. I will switch it to ready for review after the bump, and the diff above that one line is unaffected.

`devtools.settingsDefaults` hands the project's panel defaults to
`createUi({ settingsDefaults })`, which resolves them below each
developer's own choice in Settings. It is the Vite half of leaving a
command such as `Mod+K` unbound for everyone working in the repo.

The three dock lists stay out of the type: their stored value is always
present, so a seeded list could never be undone from Settings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant