Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate @woocommerce/data options store to TS #33168

Merged
merged 3 commits into from May 25, 2022

Conversation

chihsuan
Copy link
Member

@chihsuan chihsuan commented May 24, 2022

All Submissions:

Changes proposed in this Pull Request:

Part of #33105

This PR migrates options stores to TS and fixes type errors in ./client after migrating options store to TS

How to test the changes in this Pull Request:

  1. Should run pnpm nx build @woocommerce/data without errors
  2. Should run pnpm nx test @woocommerce/data without errors

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully run tests with your changes locally?
  • Have you created a changelog file for each project being changed, ie pnpm nx changelog <project>?

FOR PR REVIEWER ONLY:

  • I have reviewed that everything is sanitized/escaped appropriately for any SQL or XSS injection possibilities. I made sure Linting is not ignored or disabled.

@github-actions github-actions bot added focus: react admin package: @woocommerce/data issues related to @woocommerce/data plugin: woocommerce Issues related to the WooCommerce Core plugin. labels May 24, 2022
@chihsuan chihsuan force-pushed the dev/migrate-woo-data-options-to-ts branch from edd4435 to 97ebeec Compare May 24, 2022 03:26
const { dismissTask, undoDismissTask } = useDispatch( OPTIONS_STORE_NAME );
const { dismissTask, undoDismissTask } = useDispatch(
ONBOARDING_STORE_NAME
);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found a bug with the TS check. dismissTask and *Task are in the onboarding store, not options store.

export function* dismissTask( id ) {
yield dismissTaskRequest( id );
try {
const task = yield apiFetch( {
path: `${ WC_ADMIN_NAMESPACE }/onboarding/tasks/${ id }/dismiss`,
method: 'POST',
} );
yield dismissTaskSuccess(
DeprecatedTasks.possiblyPruneTaskData( task, [
'isDismissed',
'isSnoozed',
] )
);
} catch ( error ) {
yield dismissTaskError( id, error );
throw new Error();
}
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch! I wonder how this didn't result in an error before 🤔

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps cc @joelclimbsthings @woocommerce/mothra in case if there's anything worth looking

@chihsuan chihsuan marked this pull request as ready for review May 24, 2022 03:32
@chihsuan chihsuan self-assigned this May 24, 2022
@chihsuan chihsuan requested a review from a team May 24, 2022 03:32
@botwoo
Copy link
Collaborator

botwoo commented May 24, 2022

📊 Test reports for this pull request have been published and are accessible through the following links:

Latest commit referenced in the reports: Add changelogs 4d9e07b
This comment will automatically be updated with the latest referenced commit when you push new changes to this pull request.


Visit the WooCommerce Test Reports homepage to view all published reports. See the FAQs page if you're having problems accessing them.

@chihsuan chihsuan force-pushed the dev/migrate-woo-data-options-to-ts branch from 97ebeec to 991de47 Compare May 24, 2022 10:16
@chihsuan chihsuan force-pushed the dev/migrate-woo-data-options-to-ts branch from 991de47 to 4d9e07b Compare May 24, 2022 13:41
Copy link
Contributor

@ilyasfoo ilyasfoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests well, LGTM 🚢

@chihsuan chihsuan merged commit 0240a29 into trunk May 25, 2022
@chihsuan chihsuan deleted the dev/migrate-woo-data-options-to-ts branch May 25, 2022 05:20
@github-actions github-actions bot added this to the 6.7.0 milestone May 25, 2022
@github-actions
Copy link
Contributor

Hi @chihsuan, thanks for merging this pull request. Please take a look at these follow-up tasks you may need to perform:

  • Add the release: add testing instructions label

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: @woocommerce/data issues related to @woocommerce/data plugin: woocommerce Issues related to the WooCommerce Core plugin.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants