woocommerce/plugins/woocommerce-admin/client/marketing/hooks
Eason d57b9e1d05
Make the `useCampaigns` hook support being used with multiple instances (#41211)
* Add tests for the `useCampaigns` hook in the woocommerce-admin marketing.

* Add `channels` to the deps of `useSelect` in the `useCampaigns` hook to avoid outdated hook states.

* Make the `useCampaigns` hook support being used with multiple instances.

- Include the `perPage` in the page key of campaigns in the multichannel's data store.
- Move the processing of querying the campaigns paging to the selector of the multichannel's data store.
- Move `total` in each campaign's paging of the multichannel's data store.
- Remove unused properties and their types: `state.campaigns.perPage` and `state.campaigns.total`

* Add changelog

* Multichannel data store - Move the `total` from `campaigns.pages[*]` to `campaigns.meta` to have only one total value.

Related to:
- https://github.com/woocommerce/woocommerce/pull/41211#discussion_r1409634640
- https://github.com/woocommerce/woocommerce/pull/41211#discussion_r1409590559

* Multichannel data store - Return the pagination meta of campaigns along with the `getCampaigns` selector.

Address: https://github.com/woocommerce/woocommerce/pull/41211#discussion_r1412266127
2023-12-05 11:20:05 +08:00
..
test Make the `useCampaigns` hook support being used with multiple instances (#41211) 2023-12-05 11:20:05 +08:00
index.ts Fix hook file name with correct casing. 2023-03-22 16:51:25 +08:00
useCampaignTypes.ts Specify empty array dependency in useCampaignTypes. 2023-03-11 00:42:09 +08:00
useCampaigns.ts Make the `useCampaigns` hook support being used with multiple instances (#41211) 2023-12-05 11:20:05 +08:00
useInstalledPluginsWithoutChannels.ts Fix hook file name with correct casing. 2023-03-22 16:51:25 +08:00
useIntroductionBanner.ts Fix useSelect dependency in useIntroductionBanner. 2023-03-19 20:50:37 +08:00
useRecommendedChannels.ts Specify empty array as hasFinishedResolution args. 2023-03-14 03:35:20 +08:00
useRegisteredChannels.ts Specify empty array as invalidateResolution and hasFinishedResolution args. 2023-03-14 03:32:54 +08:00