canvas-data-fetching

Fetch Drupal content for Canvas components using JSON:API and SWR.

14|2|Updated Feb 14, 2025
One-click install
npx skills add https://github.com/balintbrews/canvas-starter --skill canvas-data-fetching-balintbrews
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: canvas-data-fetching
Source: https://github.com/balintbrews/canvas-starter/tree/main/.agents/skills/canvas-data-fetching
Command: npx skills add https://github.com/balintbrews/canvas-starter --skill canvas-data-fetching-balintbrews

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Fetch data for Canvas components from Drupal using JSON:API and SWR patterns to simplify rendering content lists and related entities.

Core Features & Use Cases

  • Data fetching with SWR for caching, revalidation, and a hook-based API.
  • Drupal JSON:API querying with JsonApiClient and DrupalJsonApiParams.
  • Handling relationships, includes, and selective fields to minimize payloads.

Quick Start

Fetch Drupal content for Canvas components using JSON:API and SWR patterns.

Frequently Asked Questions about canvas-data-fetching

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fetch Drupal content into Canvas components?

Fetch Drupal content into Canvas components using JSON:API and SWR patterns. This approach simplifies rendering content lists and related entities by leveraging hook-based data fetching.

What's the best way to handle Drupal JSON:API relationships without circular references?

Handle Drupal JSON:API relationships by enforcing includes and selective field selection. This minimizes payloads and avoids circular references for performant requests.

Can I use SWR with Drupal JSON:API for content caching?

Yes, you can use SWR with Drupal JSON:API for content caching. SWR provides revalidation and a hook-based API to manage data fetching in Canvas components.

How do I query related entities using JsonApiClient and DrupalJsonApiParams?

Query related entities using JsonApiClient and DrupalJsonApiParams to build content lists. These tools handle JSON:API querying and relationship integration within your Canvas components.

Why does fetching Drupal JSON:API content cause large payloads?

Large payloads occur without selective field selection. Enforce includes and field selection in your Drupal JSON:API requests to minimize payload size and improve performance.

Does this data fetching approach work for building content lists in Canvas?

Yes, this data fetching approach works for building content lists in Canvas. It integrates SWR caching with Drupal JSON:API querying to render content lists and related entities.