fix: remove deprecated Shopify REST Admin API, add module-level cache to avoid re-fetch on modal re-open

This commit is contained in:
Ishaan Jaffer 2026-03-10 14:10:46 -07:00
parent 8ecb95223e
commit 0fc37ca3af
2 changed files with 11 additions and 18 deletions

View file

@ -184,23 +184,6 @@
{ "name": "reactions_add", "description": "Add an emoji reaction to a message" }
]
},
{
"name": "shopify",
"title": "Shopify",
"description": "Products, orders, customers, and store management via Shopify Admin REST API (requires your store subdomain)",
"icon_url": "https://cdn.simpleicons.org/shopify",
"spec_url": "https://raw.githubusercontent.com/Shopify/shopify-api-specs/main/admin/rest/2023-10/openapi.json",
"key_tools": [
{ "name": "list_products", "description": "List products with variants, pricing, and inventory" },
{ "name": "get_product", "description": "Get full product details including all variants" },
{ "name": "list_orders", "description": "List orders with status, customer, and line item filters" },
{ "name": "get_order", "description": "Get full order details including shipping and payment" },
{ "name": "list_customers", "description": "List customers with order history and tags" },
{ "name": "update_order", "description": "Update order notes, tags, or shipping address" },
{ "name": "create_fulfillment", "description": "Fulfill an order with tracking info" },
{ "name": "list_inventory_levels", "description": "Get stock levels across locations" }
]
},
{
"name": "snowflake",
"title": "Snowflake",

View file

@ -28,6 +28,9 @@ interface OpenAPIQuickPickerProps {
onSelect: (entry: OpenAPIRegistryEntry) => void;
}
// Module-level cache so repeated modal opens don't re-fetch the static registry.
let registryCache: OpenAPIRegistryEntry[] | null = null;
const OpenAPIQuickPicker: React.FC<OpenAPIQuickPickerProps> = ({
accessToken,
selectedName,
@ -39,9 +42,16 @@ const OpenAPIQuickPicker: React.FC<OpenAPIQuickPickerProps> = ({
useEffect(() => {
if (!accessToken) return;
if (registryCache !== null) {
setApis(registryCache);
return;
}
setLoading(true);
fetchOpenAPIRegistry(accessToken)
.then((data) => setApis(data.apis ?? []))
.then((data) => {
registryCache = data.apis ?? [];
setApis(registryCache);
})
.catch(() => setApis([]))
.finally(() => setLoading(false));
}, [accessToken]);