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

Remove Instant Results' dependency on @wordpress/date and @wordpress/components #2774

Merged
merged 4 commits into from
May 19, 2022

Conversation

JakePT
Copy link
Contributor

@JakePT JakePT commented May 18, 2022

Description of the Change

Replaces the implementation of SlotFill with a basic React portal for the active facets chips. This removes the dependency on @wordpress/components which is very large.

Also replaces the use of @wordpress/date, which is also quite large, with the use of Date.toLocaleDateString(). This reduces the options for date formatting, but we weren't supporting that yet anyway.

Closes #2768.

Verification Process

In Instant Results verify that the active facets can be seen and clicked to remove when filtering results. Also verify that the wp-components dependency is not loaded.

Also verify that the date on Post results is displayed correctly, and updates according to the site's language.

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests passed.

Changelog Entry

Changed - Removed Instant Results' dependency on @wordpress/components and @wordpress/date.

Credits

Props @JakePT

@felipeelia felipeelia self-assigned this May 18, 2022
@felipeelia felipeelia added this to the 4.2.0 milestone May 18, 2022
@felipeelia
Copy link
Member

@JakePT I tried this one but I'm seeing two errors:

  1. As is, I'm getting a Cannot destructure property 'gmdateI18n' of 'wp.date' as it is undefined. error coming from this line. Making that import { gmdateI18n } from '@wordpress/date'; seems to fix it.
  2. If I search for "post", for example, and click on the search button, it opens the modal. If I close it and click on the search button again I get an error in the console that seems to be related to this line.

@JakePT
Copy link
Contributor Author

JakePT commented May 19, 2022

@felipeelia Thanks. I've pushed fixes for both these issues. Let me know if it works for you. I've also pushed a change to get rid of the @wordpress/date dependency, it just means that the date format will be determined by JavaScript's Date.toLocaleString() method, but at least the site's language is used.

@JakePT JakePT changed the title Replace SlotFill implementation with a basic portal in Instant Results Remove Instant Results' dependency on @wordpress/date and @wordpress/components May 19, 2022
@felipeelia felipeelia merged commit 7c9a32d into develop May 19, 2022
@felipeelia felipeelia deleted the feature/2768 branch May 19, 2022 12:48
felipeelia added a commit that referenced this pull request May 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reduce size of Instant Results dependencies
2 participants