Skip to content

Instantly share code, notes, and snippets.

View edlaver's full-sized avatar

Ed Laver edlaver

View GitHub Profile
@edlaver
edlaver / writeMetafieldFromGadgetRecord.js
Last active November 7, 2023 10:57
Add as an update effect to a Gadget record that has your metafield.
module.exports = async ({ api, record, params, logger, connections }) => {
const metafieldNamespace = "<Your metafield namespace>";
const metafieldKey = "<Your metafield key>";
const metafieldType = "json"
const metafieldOwnerId = `gid://shopify/Shop/${record.id}`; // `record.id` here is the ID of our `shop` record
const gadgetFieldName = "<The matching field name in your gadget record, e.g. myMetafield>";
// Check if record change includes our metafield data
if (record.changed(gadgetFieldName)) {
logger.info(
@edlaver
edlaver / helpPage.jsx
Created September 13, 2023 10:00
Example service to fetch a Notion record map from a cf-notion-cache worker, and render it in a Polaris container
import React from "react";
import {
Layout,
LegacyCard,
Page,
SkeletonBodyText,
SkeletonDisplayText,
TextContainer,
} from "@shopify/polaris";
@edlaver
edlaver / readme.md
Last active February 21, 2024 12:25
Getting triggered by Gadget - Trigger.dev integration with Gadget.dev 🤝

Trigger.dev is "The open source Background Jobs framework for TypeScript".

It allows you to "Create long-running Jobs directly in your codebase with features like API integrations, webhooks, scheduling and delays."

It has support for frameworks such as Next.js, Express, and Remix. But can it work with Gadget? 🤔

Turns out the answer is "Yes", and it works great!