Clanbite Social Kit

clanbite_social_kit_apply_social_feed_snapshot_to_store( array $snapshot, array $messages, string $feed_key = '' ): array<string,mixed>

Merge SSR feed data into the clanbite-social/feed store and return block context fields.

Used by the social feed and social composer blocks so the first paint does not depend on a client fetch.

**Posts are not returned in this fragment.** Post rows are written to the Interactivity store namespace clanbite-social/feed via clanbite_social_kit_replace_interactivity_feed_posts_atomically() because wp_interactivity_state() merges with array_replace_recursive(), which corrupts indexed posts[] when multiple interactive roots share the same store (feed + composer on one template). The hydrated client reads state.posts from the serialized store payload (footer JSON), not from data-wp-context.

Parameters

$snapshot (array<string,mixed>) Required

From \Kernowdev\ClanbiteSocialKit\Rest\Rest_Controller::get_social_feed_block_initial_snapshot().

$messages (array<string,string>) Required

Error strings keyed by snapshot reason (loginRequired, profileUnresolved, teamUnresolved, teamFeedForbidden, groupUnresolved, groupFeedForbidden).

$feed_key (string) Optional

Key of the feed the snapshot belongs to ({context}:{subject}); paging state is stored under it.

Default: ''

Returns

array<string,mixed> Context fragment: isLoading, feedSsrHydrated, hasMore, error, feedError.

Defined in inc/social-feed-interactivity-state.php