Skip to content

Conversation

@tyxla
Copy link
Member

@tyxla tyxla commented Jul 18, 2022

Proposed Changes

This PR introduces a new @automattic/is-plain-object package that is intended to be public, and used both in Calypso and in Gutenberg as a replacement for Lodash's isPlainObject() function.

See WordPress/gutenberg#42471 (comment) for the motivation for this package. Essentially, we're aiming to minimize the creation of new packages as Lodash replacements, but we will still end up having a few of them for the greater good.

Testing Instructions

  • Verify all package tests pass: yarn test-packages packages/is-plain-object
  • Verify all state tests pass: yarn test-client state
  • Verify all checks are green and there are no TS errors/warnings introduced.
  • Verify the preferences helper still works (displayed when you roll over the environment name in Calypso on non-prod environments).

Pre-merge Checklist

Complete applicable items on this checklist before merging into trunk. Inapplicable items can be left unchecked.

Both the PR author and reviewer are responsible for ensuring the checklist is completed.

@tyxla tyxla added Framework [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. [Type] Task [Tests] Includes Tests Packages labels Jul 18, 2022
@tyxla tyxla requested review from a team and flootr July 18, 2022 10:14
@tyxla tyxla self-assigned this Jul 18, 2022
@github-actions
Copy link

github-actions bot commented Jul 18, 2022

@matticbot
Copy link
Contributor

matticbot commented Jul 18, 2022

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

App Entrypoints (~98 bytes added 📈 [gzipped])

Details
name           parsed_size           gzip_size
entry-main          +232 B  (+0.0%)      +97 B  (+0.0%)
entry-login         +232 B  (+0.0%)      +99 B  (+0.0%)
entry-stepper       +228 B  (+0.0%)      +94 B  (+0.0%)

Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used.

Async-loaded Components (~86 bytes added 📈 [gzipped])

Details
name                                       parsed_size           gzip_size
async-load-calypso-lib-preferences-helper       +232 B  (+0.2%)      +86 B  (+0.3%)

React components that are loaded lazily, when a certain part of UI is displayed for the first time.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

@matticbot
Copy link
Contributor

This PR modifies the release build for editing-toolkit

To test your changes on WordPress.com, run install-plugin.sh editing-toolkit add/is-plain-object-package on your sandbox.

To deploy your changes after merging, see the documentation: PCYsg-mMA-p2

@flootr
Copy link
Contributor

flootr commented Jul 18, 2022

While this works well for me, what about using an existing package like is-plain-obj?

@tyxla
Copy link
Member Author

tyxla commented Jul 18, 2022

That one didn't come in my search for some reason - thanks @flootr. Looking at it, it seems like it's the same functionality we need, and comes with TS bindings, so I'm going to give it a try and close this one for now.

@tyxla tyxla closed this Jul 18, 2022
@tyxla tyxla deleted the add/is-plain-object-package branch July 18, 2022 13:31
@github-actions github-actions bot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jul 18, 2022
@tyxla
Copy link
Member Author

tyxla commented Jul 18, 2022

See #65680 for a variant using is-plain-obj.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants