Skip to content

Let extension hooks that only change stylesheets keep Vue hydration (rethink how hooks declare their effects) #804

Open

Description

@JuroOravec

(Opus 5.5)

On a Vue page, Citry turns hydration off when any extension defines on_dependencies, on_js_loaded, prepare_browser_render or browser_plugin, or when a component overrides on_dependencies (_hydration_page_reason in packages/py/citry/citry/_vue/serialization.py). Vue then replaces the server HTML instead of adopting it. The page works, but it renders twice in the browser and may flicker. The docs for extensions do not mention this cost.

The rule exists because such a hook can add browser behavior the server renderer does not know about, for example a Vue plugin installed through early_scripts, so adopting the server HTML could mismatch. It is a correctness rule: the CSP, security_javascript and nonce checks run separately.

The cost shows up for hooks that only change stylesheets, such as compiling SCSS. citry-django needs this to compile SCSS for components rendered as separate Vue apps on a Django page.

The obvious fix is an opt-in flag on Extension ("this hook only changes stylesheets"). Before adding it, rethink how extensions declare what their hooks do: more per-hook flags is the wrong direction. Options to weigh:

  • let Citry see what a hook changed (compare scripts before and after the hook) instead of trusting a declaration;
  • split stylesheet changes into their own hook that never affects hydration;
  • a single structured declaration of a hook's effects instead of separate flags.

Either way, document the hydration cost on the extensions page.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KUhrHaXagmW5ZxpRAMwyom

Activity

  1. added this to the Next sprint milestone on Nov 19, 2026
  2. added
    next-sprint
    on Nov 19, 2026
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

    next-sprint

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions