Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions projects/packages/forms/changelog/fix-preload-middleware
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Forms: fix preload middleware registration to properly cache API requests and support both path formats.
5 changes: 4 additions & 1 deletion projects/packages/forms/src/dashboard/class-dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,15 @@ public function load_admin_scripts() {
),
'/wp/v2/feedback'
);
$filters_path = '/wp/v2/feedback/filters';
$filters_locale_path = \add_query_arg( array( '_locale' => 'user' ), $filters_path );
$preload_paths = array(
'/wp/v2/types?context=view',
'/wp/v2/feedback/config',
'/wp/v2/feedback/integrations?version=2',
'/wp/v2/feedback/counts',
'/wp/v2/feedback/filters',
$filters_path,
$filters_locale_path,
$initial_responses_path,
$initial_responses_locale_path,
);
Expand Down
2 changes: 1 addition & 1 deletion projects/packages/forms/src/dashboard/store/resolvers.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const getFilters =
() =>
async ( { dispatch } ) => {
const results = await apiFetch( {
path: 'wp/v2/feedback/filters',
path: '/wp/v2/feedback/filters',
} );
dispatch.receiveFilters( results );
};
Expand Down
Loading