Questions about the compatibility and dependencies of the "hydrogen-sanity" library in Shopify Hydrogen (Remix) and Sanity.

3 replies
Last updated: Mar 7, 2024
Hi all,Started getting a proof of concept going with a template I found. I'm working specifically with Shopify Hydrogen (Remix) and Sanity. This template uses a library called "hydrogen-sanity" and we are trying to get it working. I have 2 very specific questions.
1: is
Hydrogen-Sanity supported (it seems active) and is it's underlying use of potentially deprecated methods okay to use still?2: When talking about 'Live Preview' and 'Visual Editing'. Are these 2 dependant on each other? It seems like getting a preview to render and update with live changes to content lake data is one thing, and you could additionally add the visual editing as a nice feature, but do they require both for each to work?
AI Update

Based on my research of the hydrogen-sanity library and its GitHub repository, here are answers to your specific questions:

1. Is hydrogen-sanity supported and are deprecated methods okay to use?

Yes, hydrogen-sanity is actively supported and maintained. The library is currently at version 5.1.1 (released November 18, 2025) with 285 commits and regular updates from the official Sanity team.

Regarding deprecated methods - this depends on which version your template is using:

  • If using v5 (current): You're good to go! The methods are current and supported
  • If using v4 or earlier: You may encounter deprecated patterns, but the team provides clear migration guides for upgrading

The library requires @shopify/hydrogen >= 2025.5.0 and supports modern Hydrogen/Remix Router patterns. If your template is older, I'd recommend reviewing the migration guides to ensure you're using current, supported methods rather than deprecated ones.

Note on Shopify Hydrogen/Remix: Hydrogen recently transitioned from using Remix to React Router (Hydrogen now uses Remix Router under the hood, but the framework itself has evolved). Make sure your template is compatible with current Hydrogen versions.

2. Are Live Preview and Visual Editing dependent on each other?

No, they are NOT dependent on each other - they're complementary but separate features that can work independently:

Live Preview (Real-time Content Updates)

  • Shows Sanity content changes in real-time as you edit
  • Can work without Visual Editing overlays
  • Achieved through:
    • Server-side: loadQuery or fetch methods with preview mode
    • Client-side: Query component or useQuery hooks for live synchronization

Visual Editing (Click-to-Edit Overlays)

  • Provides interactive overlays in Sanity's Presentation tool
  • Enables click-to-edit functionality with element highlighting
  • Requires:
    • VisualEditing component (or Overlays component)
    • Stega encoding enabled in client config
  • Can work without live preview (though less useful)

How to Use Them

The VisualEditing component offers flexible configuration:

// Server-only preview (no overlays)
<VisualEditing /> 

// Full experience (auto-enables live mode when using Query components)
<VisualEditing action="/api/preview" />

// Or use separately for fine-grained control:
<Overlays action="/api/preview" /> // Just overlays
<LiveMode /> // Just live content sync

Bottom line: You can have live preview content updates rendering from Content Lake without visual editing overlays. However, for the full Presentation tool experience with click-to-edit functionality, you'll want both features enabled. The library intelligently detects your data fetching patterns and enables the appropriate features automatically.

To be a little more clear. Is implementing preview/live-preview, you don't have to use the visual-editing package as well to have everything work? The visual-editing would be dependant on getting preview / live-preview hooked up, but not the other way around correct?
You’ve got that correct! In terms of the Hydrogen package, that’s very much still supported.
user M
Thank you for clarifying! Appreciate the response. Will move forward using this package 🙂

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?