Skip to content

Conversation

@vividviolet
Copy link
Member

@vividviolet vividviolet commented Apr 15, 2025

Background

Fix https://github.com/Shopify/app-ui/issues/2211

🎩

  1. Follow this doc to create a block extension
  2. Open the package.json of the extension and update to use the 0.0.0-snapshot-20250421182514 snapshot with the fixed types. Note that the types for the snapshot was generated with this PR for building individual d.ts files for each component.
  3. Run pnpm install to install the snapshot
  4. Update your extension code to be as follows:
import {render} from 'preact';
export default function extension() {
  render(<Extension />, document.body);
}

function Extension() {
  return (
    <s-admin-block title="My Block Extension">
      <s-form onSubmit={(event) => {
        event.waitUntil((async () => {
          console.log('saving');
          close();
        })());
      }}>
      <s-button onClick={(event) => {
        console.log('clicked', event);
      }}>Test button</s-button>
      </s-form>
    </s-admin-block>
  );
}
  1. Verify that you get the event typed as either Event for the Button onClick handler
image 7. Verify that you get the event typed as `ExtendableEvent` for the Form onSubmit handler image

Checklist

  • I have 🎩'd these changes
  • I have updated relevant documentation

@vividviolet vividviolet changed the base branch from unstable to 2025-07-rc April 15, 2025 15:01
@vividviolet
Copy link
Member Author

/snapit

@shopify-github-actions-access
Copy link
Contributor

🫰✨ Thanks @vividviolet! Your snapshot has been published to npm.

Test the snapshot by updating your package.json with the newly published version:

"@shopify/ui-extensions": "0.0.0-snapshot-20250415150153"

@vividviolet
Copy link
Member Author

/snapit

@shopify-github-actions-access
Copy link
Contributor

🫰✨ Thanks @vividviolet! Your snapshot has been published to npm.

Test the snapshot by updating your package.json with the newly published version:

"@shopify/ui-extensions": "0.0.0-snapshot-20250415163640"

@vividviolet
Copy link
Member Author

/snapit

@shopify-github-actions-access
Copy link
Contributor

🫰✨ Thanks @vividviolet! Your snapshot has been published to npm.

Test the snapshot by updating your package.json with the newly published version:

"@shopify/ui-extensions": "0.0.0-snapshot-20250415175606"

@vividviolet
Copy link
Member Author

/snapit

@shopify-github-actions-access
Copy link
Contributor

🫰✨ Thanks @vividviolet! Your snapshot has been published to npm.

Test the snapshot by updating your package.json with the newly published version:

"@shopify/ui-extensions": "0.0.0-snapshot-20250415203727"

@vividviolet
Copy link
Member Author

/snapit

@shopify-github-actions-access
Copy link
Contributor

🫰✨ Thanks @vividviolet! Your snapshot has been published to npm.

Test the snapshot by updating your package.json with the newly published version:

"@shopify/ui-extensions": "0.0.0-snapshot-20250421181747"

@vividviolet
Copy link
Member Author

/snapit

@shopify-github-actions-access
Copy link
Contributor

🫰✨ Thanks @vividviolet! Your snapshot has been published to npm.

Test the snapshot by updating your package.json with the newly published version:

"@shopify/ui-extensions": "0.0.0-snapshot-20250421182514"

@vividviolet vividviolet force-pushed the fix-event-types branch 2 times, most recently from 8be9cf6 to 3441ec5 Compare April 22, 2025 21:16
@vividviolet
Copy link
Member Author

/snapit

@shopify-github-actions-access
Copy link
Contributor

🫰✨ Thanks @vividviolet! Your snapshot has been published to npm.

Test the snapshot by updating your package.json with the newly published version:

"@shopify/ui-extensions": "0.0.0-snapshot-20250422211948"

@vividviolet vividviolet marked this pull request as ready for review April 22, 2025 21:31
@vividviolet
Copy link
Member Author

/snapit

@shopify-github-actions-access
Copy link
Contributor

🫰✨ Thanks @vividviolet! Your snapshot has been published to npm.

Test the snapshot by updating your package.json with the newly published version:

"@shopify/ui-extensions": "0.0.0-snapshot-20250422220349"

Copy link
Member

@henrytao-me henrytao-me left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎩-ed. LGTM

@vividviolet vividviolet merged commit 2ec7d99 into 2025-07-rc Apr 24, 2025
4 checks passed
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