Skip to content
Source
Sign inSign up
TanStack/pacer

fix(pacer-devtools): remove inline style objects to fix setStyleProperty export error #169

OpenrestareaByWeezy(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/169/headopened

Fixes #131

When using @tanstack/react-pacer-devtools in a Next.js application, the following error occurs during SSR:

Export setStyleProperty doesn't exist in target module import { ..., setStyleProperty, ... } from "solid-js/web"

The root cause is that the Solid.js compiler transforms JSX inline style objects (style={{ ... }}) into setStyleProperty() calls. This function is exported from solid-js/web's browser build (web.js), but not from its server build (server.js). Since Next.js resolves solid-js/web using the server condition during SSR bundling, the function cannot be found.

To fix this, all inline style objects in the pacer-devtools components have been replaced with goober CSS classes, which is already the established pattern in this codebase. The one dynamic value (left panel width) is handled via a string-based style attribute, which the Solid compiler compiles to setAttribute rather than setStyleProperty.

Changes:

  • packages/pacer-devtools/src/styles/use-styles.ts: added min-width and max-width to the leftPanel class, added new stateHeaderRow and reductionValue classes
  • packages/pacer-devtools/src/components/Shell.tsx: replaced style object with string attribute for dynamic width, removed redundant flex: 1 (already present in rightPanel class)
  • packages/pacer-devtools/src/components/StateHeader.tsx: replaced two inline style objects with goober CSS classes

There are no visual or behavioral changes. The fix can be verified by checking that setStyleProperty no longer appears in the build output after this change.

grep -r "setStyleProperty" packages/pacer-devtools/dist/ # should return no results

    1. ⚠️ No Changeset found

      Latest commit: 6cc0ff147588ee742e4f61acc82b4825d83c6d6c

      Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

      This PR includes no changesets

      When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

      Click here to learn what changesets are, and how to add one.

      Click here if you're a maintainer who wants to add a changeset to this PR

    2. I'm wondering if it's more appropriate for the devtools to be expected to be client side only rendering

    3. @KevinVandy Thanks for the feedback! I checked the react-pacer-devtools entry point and 'use client' is actually already declared on line 1 of src/index.ts. So even with that directive in place, the error was still happening.

      The root cause turned out to be that the Solid.js compiler transforms inline style objects like style={{ flex: 1 }} into setStyleProperty() calls at build time, and those calls end up as explicit imports from solid-js/web in the compiled output. The server build of solid-js/web (which Next.js resolves during SSR bundling) simply doesn't export setStyleProperty, so the error occurs before any component even tries to render.

      This fix removes all inline style objects from the components and replaces them with goober CSS classes, which is already the pattern used throughout the rest of the devtools codebase. That way the compiler never emits setStyleProperty calls in the first place.

    4. "use client" does not mean "client only". It only means server and client. So that has nothing to do with it.

      What I was meaning was that most meta frameworks export a <ClientOnly> component wrapper or something like that.

      That being said, other tanstack maintainers have recommended that we make this change too like here: https://github.com/TanStack/pacer/pull/181

      So we will probably ship this or that pr

    5. @KevinVandy Thanks for the correction — I appreciate you explaining the distinction between 'use client' and client-only rendering, that's a good point I hadn't considered properly.

      I took a look at #181 and it addresses the same issue with a similar approach. Totally fine to close this one if that PR gets merged first — just happy to see this getting fixed either way!

Sign in to join this conversation.