Automattic / Automattic/jetpack

Async load block deprecations?

Open
#17,467 1 comment 0 reactions 0 assignees View on GitHub
[Focus] Blocks Enhancement
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.