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

E2E wpDataSelect: Explain why it returns undefined sometimes #31227

Merged
merged 1 commit into from
May 3, 2021
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
13 changes: 13 additions & 0 deletions packages/e2e-test-utils/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,19 @@ _Parameters_

Queries the WordPress data module.

`page.evaluate` - used in the function - returns `undefined`
when it encounters a non-serializable value.
Since we store many different values in the data module,
you can end up with an `undefined` result. Before using
this function, make sure the data you are querying
doesn't contain non-serializable values, for example,
functions, DOM element handles, etc.

_Related_

- <https://pptr.dev/#?product=Puppeteer&version=v9.0.0&show=api-pageevaluatepagefunction-args>
- <https://github.com/WordPress/gutenberg/pull/31199>

_Parameters_

- _store_ `string`: Store to query e.g: core/editor, core/blocks...
Expand Down
11 changes: 11 additions & 0 deletions packages/e2e-test-utils/src/wp-data-select.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
/**
* Queries the WordPress data module.
*
* `page.evaluate` - used in the function - returns `undefined`
* when it encounters a non-serializable value.
* Since we store many different values in the data module,
* you can end up with an `undefined` result. Before using
* this function, make sure the data you are querying
* doesn't contain non-serializable values, for example,
* functions, DOM element handles, etc.
*
* @see https://pptr.dev/#?product=Puppeteer&version=v9.0.0&show=api-pageevaluatepagefunction-args
* @see https://github.com/WordPress/gutenberg/pull/31199
*
* @param {string} store Store to query e.g: core/editor, core/blocks...
* @param {string} selector Selector to exectute e.g: getBlocks.
* @param {...Object} parameters Parameters to pass to the selector.
Expand Down