Skip to content

Sanity Studio v4 and v5 Compatibility - #8

Open
srothgan wants to merge 9 commits into
LiahMartens:mainfrom
srothgan:main
Open

srothgan wants to merge 9 commits into
LiahMartens:mainfrom
srothgan:main

Conversation

@srothgan

Copy link
Copy Markdown

Overview

This PR adds full support for Sanity Studio v4 and v5, bringing the plugin up to date with the latest Sanity releases while maintaining backward compatibility patterns.

Summary of Changes

Core Compatibility Upgrades (v3.0.0)

Dependency Updates:

  • Upgraded sanity peer dependency to ^4.0.0 || ^5.0.0 (supports both v4 and v5)
  • Upgraded @sanity/ui from ^1.0.0 to ^3.0.0
  • Updated react and react-dom to support ^18.0.0 || ^19.0.0
    • React 18 for Sanity Studio v4
    • React 19 for Sanity Studio v5
  • Minimum Node.js requirement: v20.19+

Code Updates:

  • Replaced deprecated useFormBuilder hook with useFormValue hook (required for v4/v5)
  • Updated build configuration to properly strip source paths
  • Migrated from Babel to SWC for faster builds
  • Updated TypeScript to 5.3 with improved type safety

Bug Fixes & Improvements (v3.0.1 - v3.0.3)

v3.0.1 - Community & DevOps:

  • Added GitHub Actions workflows (build verification, npm publishing with OIDC)
  • Added Dependabot configuration for automated dependency updates
  • Created issue templates (bug report, feature request, question)
  • Added pull request template
  • Created CONTRIBUTING.md and CODE_OF_CONDUCT.md
  • Enhanced README with TypeScript examples and troubleshooting section

v3.0.2 - Critical Bug Fix:

  • Fixed input interruption issue where keystrokes were causing re-renders
  • Removed unnecessary useEffect dependency that was triggering unwanted updates

v3.0.3 - Documentation:

  • Restructured Usage section with progressive disclosure pattern
  • Split configuration options into three clear subsections
  • Moved TypeScript usage examples for better documentation flow
  • Added comprehensive changelog entries for all versions

Testing

The plugin has been tested and verified with:

  • Sanity Studio v4 (React 18, Node.js 20+)
  • Sanity Studio v5 (React 19, Node.js 20+)
  • All existing functionality preserved
  • All three configuration methods working (field path, manual options, GROQ queries)
  • TypeScript types properly exported

Maintained Fork

Since this repository hasn't been updated since 2023, I've published a maintained fork to help users who need v4/v5 support:

Attribution & Transparency

The fork includes:

  • Full attribution to original author @LiamMartens
  • Link back to original repository
  • Transparent succession notice in README
  • Contributor credit in package.json
  • MIT license with original copyright preserved

Collaboration Commitment

I'm happy to:

  • Redirect users back if this repository becomes active again
  • Transfer updates if you'd like to maintain this directly
  • Collaborate as co-maintainer if helpful
  • Archive the fork if you resume active maintenance

Breaking Changes

Version 3.0.0 introduces breaking changes for users on older Sanity versions:

  • No longer supports Sanity Studio v2
  • No longer supports Sanity Studio v3
  • Now requires Sanity Studio v4 or v5
  • Requires Node.js v20.19 or later

Migration Path:

  • Users on Sanity v2: Stay on plugin v1.x
  • Users on Sanity v3: Stay on plugin v2.x
  • Users on Sanity v4/v5: Upgrade to plugin v3.x

Files Changed

Core functionality:

  • src/AutoCompleteInput.tsx - Updated hooks and fixed re-render bug
  • package.json - Updated dependencies and metadata

Documentation:

  • README.md - Enhanced with examples, troubleshooting, succession notice
  • CHANGELOG.md - Full version history
  • CONTRIBUTING.md - Contribution guidelines
  • CODE_OF_CONDUCT.md - Community standards

DevOps:

  • .github/workflows/verify.yml - Build verification
  • .github/workflows/publish.yml - Automated npm publishing
  • .github/dependabot.yml - Dependency automation
  • .github/ISSUE_TEMPLATE/* - Issue templates
  • .github/PULL_REQUEST_TEMPLATE.md - PR template

Related Issues

This PR addresses the community need for Sanity Studio v4 and v5 compatibility, which has been a blocker for users upgrading their Sanity installations.


Thank you for creating this useful plugin! I hope these updates are helpful. Open to any feedback or changes you'd like to see.

srothgan and others added 6 commits December 23, 2025 17:27
BREAKING CHANGE: Updated peer dependencies to Sanity v4 and v5
- Upgraded sanity peer dependency to ^4.0.0 || ^5.0.0
- Upgraded @sanity/ui from ^1.0.0 to ^3.0.0
- Updated react and react-dom to support ^18.0.0 || ^19.0.0
- Requires Node.js v20.19 or later
- Replaced useFormBuilder with useFormValue hook
- Fixed build script to strip leading paths
- Tested and verified compatibility with both v4 and v5
- Bumped version to 3.0.0
- Add GitHub Actions workflows for build verification and npm publishing
- Add Dependabot configuration with cooldown periods
- Add issue templates (bug report, feature request, question)
- Add pull request template
- Add CONTRIBUTING.md and CODE_OF_CONDUCT.md
- Update README.md with TypeScript usage, troubleshooting, and links
- Update CHANGELOG.md with fork attribution
- Configure trusted publishing (OIDC) for npm
- Auto-generate Git tags from package.json version
- Bump version to 3.0.1
- Fix keystroke interruption when entering field for autocomplete input by removing useeffect dependency.
Improve docs for Usage and add missing Chanelogs entries
@continue

continue Bot commented Dec 27, 2025

Copy link
Copy Markdown

All Green - Keep your PRs mergeable

Learn more

All Green is an AI agent that automatically:

✅ Addresses code review comments

✅ Fixes failing CI checks

✅ Resolves merge conflicts


Unsubscribe from All Green comments

- Migrate from SWC to @sanity/pkg-utils (esbuild + rollup)
- Change output directory: lib/ → dist/
- Add dual module exports (ESM .js + CJS .cjs)
- Add .js extensions to all ESM imports for Node.js compatibility
- Update to TypeScript 5.8.3 with node16 module resolution
- Add eslint-config-sanity and prettier-plugin-packagejson
- Add npm run link-watch for easier local development
- Add format:check script for CI/CD
- Update GitHub workflows to check dist/ instead of lib/
- Add dev/ and nul to .gitignore (Windows compatibility)
- Add sideEffects: false for better tree-shaking
- Add engines field (Node.js >=18)
- Standardize code formatting (double quotes → single quotes)
…#5)

- Migrate from Prettier to Oxfmt for code formatting
- Add Oxlint alongside ESLint for linting
- Update documentation to reflect new tooling
- Add branching strategy to CONTRIBUTING.md
@LiahMartens

Copy link
Copy Markdown
Owner

@srothgan thanks a lot for the comprehensive upgrade! I will have a look over the weekend

- mostly replaced eslint with oxlint
- eslint only for imports
- removed unused packages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants