⚠️ Breaking change
The default x-picnic-agent is now 30100;1.246.1-15599; (was 1.236.1-15553). For this app version Picnic serves a few pages as a React Server Components payload (text/x-component) instead of a Fusion page. app.getPage now throws an UnexpectedPageFormatError for those pages, where it used to return JSON.
Pages affected so far (out of 95 I tested):
category-tree-root(search tab shortcuts and categories)profile-rootpromo-group-deep-dive?promo_group_id=<id>
If you call getPage on one of these, switch to the new app.getRscPage, or catch the error and fall back:
try {
const page = await client.app.getPage(pageId);
} catch (error) {
if (!PicnicClient.isUnexpectedPageFormatError(error)) throw error;
const rscPage = await client.app.getRscPage(error.pageId);
}To keep the old behaviour for now, pass the previous agent: new PicnicClient({ agent: "30100;1.236.1-15553;" }). I'd expect Picnic to move more pages over time, so that's a temporary workaround.
New
app.getRscPage(pageId): fetches a page served as RSC and parses it intorows(JSON rows by row id) andmodules(client component references). The page data is in the props of the React elements.PicnicClient.UnexpectedPageFormatErrorandPicnicClient.isUnexpectedPageFormatError.sendRequestreturnstext/x-componentresponses as raw text instead of failing onJSON.parse.
All other read-only routes that send the agent header return the same data for both agent versions.
What's Changed
Full Changelog: v4.9.0...v4.10.0