Skip to content

Check Cached Resources Structure#1073

Open
n7studios wants to merge 2 commits intomainfrom
upgrade-paths-check-cached-resource-structure
Open

Check Cached Resources Structure#1073
n7studios wants to merge 2 commits intomainfrom
upgrade-paths-check-cached-resource-structure

Conversation

@n7studios
Copy link
Copy Markdown
Contributor

Summary

Fixes this reported issue, where the site in question had cached Kit Forms in a flat array, introduced in 1.6.0 and superseded by a more detailed array of form data in 1.9.6:

Screenshot 2026-04-16 at 11 23 43

Example of how this should look:

3003590 => [
	'id'         => 3003590,
	'name'       => 'Third Party Integrations Form',
	'created_at' => '2022-02-17T15:05:31.000Z',
	'type'       => 'embed',
	'format'     => 'inline',
	'embed_js'   => 'https://cheerful-architect-3237.kit.com/71cbcc4042/index.js',
	'embed_url'  => 'https://cheerful-architect-3237.kit.com/71cbcc4042',
	'archived'   => false,
	'uid'        => '71cbcc4042',
],
2780977 => [
	'id'         => 2780977,
	'name'       => 'Modal Form',
	'created_at' => '2021-11-17T04:22:06.000Z',
	'type'       => 'embed',
	'format'     => 'modal',
	'embed_js'   => 'https://cheerful-architect-3237.kit.com/397e876257/index.js',
	'embed_url'  => 'https://cheerful-architect-3237.kit.com/397e876257',
	'archived'   => false,
	'uid'        => '397e876257',
],

This appears to happen when a creator either:

  • upgrades from Plugin version 1.6.0 through 1.9.5.x to 1.9.6 or higher, or
  • previously installed the Plugin version 1.6.0 through 1.9.5.x, uninstalled it and later installed a Plugin version 1.9.6 or higher

This PR resolves by:

  • using the latest Kit WordPress Libraries, which won't load any cached resources and return exists() as false, if the cached resource structure is invalid,
  • performing a check each time the Plugin is upgraded to ensure the cached resources are stored in the correct, expected array structure, removing them if not.

Testing

  • UpgradePathsCest: Added tests to mimic the above screenshot example of cached resources from between 1.6.0 and 1.9.5.x, ensuring they're removed/updated as necessary, depending on whether the Plugin has a connection to Kit.

Checklist

@n7studios n7studios self-assigned this Apr 16, 2026
@n7studios n7studios added the bug label Apr 16, 2026
@github-actions
Copy link
Copy Markdown

WordPress Playground

🚀 Your PR has been built and is ready for testing in WordPress Playground!

Click here to test your changes in WordPress Playground

@n7studios n7studios requested review from a team, ciccio-kit and noelherrick and removed request for a team April 16, 2026 09:10
@n7studios n7studios marked this pull request as ready for review April 16, 2026 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants