Automattic / Automattic/jetpack

Admin Performance: Jetpack Scan SVGs in JSON

Open
#22,668 1 comment 0 reactions 1 assignee Claimed by @bindlegirl View on GitHub
[Feature] Scan [Focus] Performance Enhancement Task
Dominant language
PHP
Stars
1.8k
Forks
898
Avg merge
1d 18h
Merged PRs (30d)
774

Description

I don’t have Jetpack Scan on my test site, but when it loaded the Scan resources anyway, I noticed something strange in the `Jetpack_Scan` object embedded in the page:

```

var Jetpack_Scan = {"nonce":"79ae688342","scan_endpoint":"https:\/\/jetpack.thingalon.com\/speed-01\/wp-json\/jetpack\/v4\/scan","scan_dashboard_url":"https:\/\/jetpack.com\/redirect\/?source=calypso-scanner&site=jetpack.thingalon.com%3A%3Aspeed-01","singular":"<svg width=\"18\" height=\"22\" viewBox=\"0 0 18 22\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M9 0L0 4V10C0 15.55 3.84 20.74 9 22C14.16 20.74 18 15.55 18 10V4L9 0Z\" fill=\"#D63638\"\/><path d=\"M7.99121 6.00894H10.0085V11.9968H7.99121V6.00894Z\" fill=\"#FFF\"\/><path d=\"M7.99121 14.014H10.0085V15.9911H7.99121V14.014Z\" fill=\"#FFF\"\/><\/svg> Threat found","multiple":"<svg width=\"18\" height=\"22\" viewBox=\"0 0 18 22\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M9 0L0 4V10C0 15.55 3.84 20.74 9 22C14.16 20.74 18 15.55 18 10V4L9 0Z\" fill=\"#D63638\"\/><path d=\"M7.99121 6.00894H10.0085V11.9968H7.99121V6.00894Z\" fill=\"#FFF\"\/><path d=\"M7.99121 14.014H10.0085V15.9911H7.99121V14.014Z\" fill=\"#FFF\"\/><\/svg> Threats found"};

```

It includes two SVGs in the JSON. That seems pretty inefficient; it would be better to load these as separate SVG resources so the browser can cache them, and avoid reloading them every time.

Internal reference: p1HpG7-evU-p2

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.