Since the mobile app embeds your block inside an iframe, its height won’t automatically adjust if your content changes (e.g., fetching products, expanding accordions, etc.).
Most SDK actions return Promises. Handle them properly with async/await or .then().
async function openProduct(productHandle) {
try {
await Superfans.actions.openProduct({ productHandle });
} catch (err) {
console.error("Failed to open product", err);
}
}
Use Typography Components (t1–t6) and Buttons (<filled-button>, <outlined-button>)
For consistency with your brand's theming, always use SDK components (since they take the theme directly from the theme style) instead of raw <h1-h6>,<p>,<button>.
<t2>Featured Products</t2>
<filled-button onclick="addToCart()">Add to Cart</filled-button>
Use Listeners to React to Real-Time Events
Listeners keep your block in sync with what the user does in the app (like changing a variant or adding/removing products from the cart).
They’re better than polling because they trigger only when something changes.