[Admin] Add the metaobject details form extension contract - #4630
Draft
kjbrum wants to merge 2 commits into
Draft
Conversation
Assisted-By: devx/f69a4e6e-0eb7-4653-b3e3-7097ac70f437
Assisted-By: devx/f69a4e6e-0eb7-4653-b3e3-7097ac70f437
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
Admin Web is adding an internal target that lets an app replace the visible form area on an app-owned Metaobject details page. Admin still owns route state, validation, Save, Discard, and persistence.
This PR adds the app-facing authoring and testing contract for
admin.metaobject-details.form.renderon the active2026-10-rcline. Core accepts the target from2025-10; new SDK features land on the active release-candidate line.Related work:
Solution
Add a narrow
MetaobjectFormApiand map it to the new Admin render target.The supported API contains only:
extension,intents, andnavigationfrom the baseline Admin runtime;snapshot, a read-only signal withvalueandsubscribe;setFieldValue({key, value}); andsetSaveHandler(handler | null)for pending writes that Admin must await before saving.The snapshot contains the complete trusted form definition whenever the target launches:
Admin launches the target only for definitions with at most 40 trusted fields. Larger definitions remain entirely native instead of receiving a truncated snapshot.
setFieldValuereturnsSUCCESSor one of these structural error codes:UNKNOWN_FIELDREAD_ONLYCOMPUTEDUNSUPPORTED_FIELD_TYPEINVALID_VALUEVALUE_TOO_LARGENOT_ACTIVEThe target intentionally does not expose raw form state, submit, reset, mutation helpers, a GraphQL client, tools, pickers, or caller-supplied app identity. A generic Host can expose an incidental empty
data: {}, butdatais not part of this supported contract.Component architecture
The target allows seven Polaris components:
GridGridItemHeadingSectionTextTextFieldMetaobjectField<s-metaobject-field fieldKey="..." />asks Admin to render its native editor for a field in the current route form. This preserves native behavior for references and other complex field types. The extension can combine these host-rendered fields with custom Remote DOM editors.The Preact example demonstrates the expected lifecycle:
It also restores the host value after structural rejection and reports transport failures separately.
Tester and package behavior
intentsas{launchUrl: undefined}without a fakeinvokemethod.snapshotwith no fields and no unsupportedpeekmethod.dataobject.MetaobjectFormComponentstypes.@shopify/ui-extensionsand@shopify/ui-extensions-tester.🎩
This prototype intentionally omits new automated test coverage. Validate the package contract with build and static checks:
Then verify a consumer project:
@shopify/ui-extensions/preact.admin.metaobject-details.form.renderas the target.shopify.snapshot.valueand subscribe when reactive updates are needed.shopify.setFieldValue({key, value})and handle each error code.shopify.setSaveHandler.shopify.setSaveHandler(null)during cleanup.<s-metaobject-field fieldKey="..." />.data,submit,reset, andsnapshot.peek().A full browser tophat also needs the matching Core registration and Admin Web branch. Follow
tooling/metaobject-form-extension-tophat/README.mdin the Admin Web change after Core deploys.Validation completed
git diff --checkChecklist