Skip to content

Svelte devtools utility factories differ from the shared framework contracts #503

Description

@kolaworld

TanStack Devtools version

@tanstack/devtools-utils: 0.6.0

Framework/Library version

@tanstack/svelte-devtools: 0.1.3

Describe the bug and the steps to reproduce it

The Svelte panel and plugin factories in @tanstack/devtools-utils use different contracts from the equivalent React, Preact, and Solid factories.

These differences require Svelte integrations to add framework-specific adapters and metadata even when their core and plugin already follow the established contracts.

createSveltePanel constructs the core with devtoolsProps and passes only the theme to mount():

const instance = new CoreClass(props?.devtoolsProps)
instance.mount(element, props?.theme)

The React, Preact, and Solid factories instead construct the core without arguments and pass the complete plugin props to mount():

const instance = new CoreClass()
instance.mount(element, pluginProps)

A core that implements the shared contract therefore cannot be passed directly to createSveltePanel.

A Svelte integration must wrap it in another class that translates the theme-only input back into the plugin-props object expected by the core.

createSveltePlugin also accepts only positional name and component arguments. Its result does not carry id or defaultOpen.

The React, Preact, and Solid factories accept an object containing Component, name, id, and defaultOpen, then preserve that metadata in both production and no-op plugins.

A Svelte integration must spread the factory result and append the missing metadata manually.

The two differences are related because they prevent the Svelte factories from serving as the framework adapter for a core and plugin definition that already works with the other supported frameworks.

Expected behavior

createSveltePanel should support the established core contract:

const core = new CoreClass()
core.mount(element, pluginProps)

createSveltePlugin should support the same object-form configuration as the other framework factories:

createSveltePlugin({
  Component,
  name,
  id,
  defaultOpen,
})

The preferred end state is one core contract and one plugin metadata contract across the framework factories.

Your Minimal, Reproducible Example - (Sandbox Highly Recommended)

n/a

Do you intend to try to help solve this bug with your own PR?

Yes, I am also opening a PR that solves the problem along side this issue

Terms & Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions