Issue with loading a document in Sanity Studio after creating it via a POST request.
This sounds like a routing issue where the Studio is incorrectly navigating after creating a new language document. When you create a new language version, the document is successfully created (as confirmed by the fact that refreshing works), but the Studio's navigation logic is somehow routing to an image asset instead of the newly created document.
Where to Start Troubleshooting
1. Check the network response Open your browser DevTools Network tab and find the POST request that creates the document. Verify:
- The response contains the correct document structure
- The
_idfield is what you expect - Look at what the plugin is doing with the returned document data
2. Inspect the URL after creation When the image loads instead of the document, check the URL bar. This will tell you what ID the Studio is trying to route to—it's likely showing an image asset ID rather than your document ID.
3. Check your document schema If your document type includes image fields, there might be an issue with how the plugin is extracting the document ID from the response. It could be accidentally grabbing an image asset reference instead.
4. Look at the plugin's routing logic
Since sanity-plugin-intl-input is a community plugin, check its GitHub repository for:
- Similar issue reports
- Recent updates or fixes
- The source code where it handles navigation after document creation
Potential Workarounds
Since refreshing works (confirming the document is created successfully), this is purely a client-side navigation issue in the Studio. Here are some approaches:
Option 1: Force a router refresh You might be able to patch the plugin or add custom logic to trigger a router refresh after document creation, similar to what the manual refresh does.
Option 2: Check for plugin updates
Make sure you're on the latest version of sanity-plugin-intl-input that's compatible with your Studio version. There may have been fixes for this specific issue.
Option 3: Consider alternative solutions If this issue persists, you might want to evaluate other internationalization approaches. Sanity offers several localization strategies, including the official @sanity/document-internationalization plugin (developed by Simeon Griggs and Liam Martens). Note that these are different plugins with different approaches—not direct replacements—so migration would require evaluation of whether the architecture fits your needs.
Debug Steps
Try logging what's happening in the plugin after the POST request:
- What document ID is being extracted from the response?
- What URL is being constructed for navigation?
- Is there any transformation of the document data that might be causing the confusion?
The fact that this happens specifically when returnDocument=true suggests the issue is in how the plugin processes the returned document data to construct the navigation URL. The image reference is likely being picked up from somewhere in that returned document structure.
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.