Skip to content

Support SSR and hydration for Motion host components #2489

Closed

Description

@domgan-oai

Reproduction

With Octane 0.16.7, @octanejs/motion 0.1.67, and Vite 8.3.4, load this component through Vite's ssrLoadModule with the Octane plugin and @octanejs/motion included in ssr.noExternal.

"use octane";
import { motion } from "@octanejs/motion";

export function View() {
  return (
    <motion.div data-testid="box">
      <svg viewBox="0 0 3 3">
        <path d="M0 0h1" />
      </svg>
    </motion.div>
  );
}

Vite's server import fails with The requested module 'octane/server' does not provide an export named 'provideContext'. The Motion entry also uses the client host primitive hostComponent.

Expected behavior

  • The normal Motion import renders a host and its nested content in SSR.
  • SSR emits initial variant styles, including the final keyframe when initial={false} and the units on transforms and dimensions.
  • Hydration adopts the existing host and nested SVG nodes. The client animation controller attaches to the adopted host.

A prototype using a server-only host descriptor emitted the expected styles, but the existing client path replaced all four hosts and nested SVGs in the fixture during hydration. Returning the same host descriptor from both renderer paths preserved every node and initial style. That points to a shared host path with a ref for the existing client animation controller.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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