Automattic / Automattic/jetpack
Async load block deprecations?
- Dominant language
- PHP
- Stars
- 1.8k
- Forks
- 898
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 774
Description
#### Is your feature request related to a problem? Please describe.
* Adding block deprecations increases the bundle size.
#### Describe the solution you'd like
* Is it possible to async-load the deprecations, or load only if block gets deprecated?
@sgomes mentioned:
>Perhaps making deprecated an async function to an array, rather than a simple array?
```
{
deprecated: async () => {
const deprecatedV1 = await import( './depecrated/v1' );
const deprecatedV2 = await import( './depecrated/v2' );
return [ deprecatedV1.default, deprecatedV2.default ];
},
}
```
>Other code that makes use of these properties would then have to be updated accordingly, and made to be async-safe.
#### Describe alternatives you've considered
* None.
#### Additional context
Splitting this off from a review discussion in https://github.com/Automattic/jetpack/pull/17393/files. @sgomes @simison
Contributor guide
Research direction
Start with the review discussion in PR #17393 and inspect the deprecated/v1 and deprecated/v2 modules referenced in the example. Trace the consumers of the deprecated properties and determine the async-safety and bundle-size requirements; done means an agreed design with the affected consumers updated and the impact verified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100