Repository navigation
Conversation
…islands
- Enable WebP resizing in `ResizingAssetTransformer` (`package:image` `WebPDecoder`/`WebPEncoder`), preserving lossless WebP encoding and extracting the final composited poster frame when downsizing multi-megabyte animated WebP card thumbnails (`11.38 MB` -> `56.4 KB` across homepage featured news cards).
- Remove synchronous `recaptcha/api.js` (`360 KB`) from `NewsletterSection` and lazy-load `recaptcha/api.js?render=explicit` once on first input focus in `NewsletterForm`.
- Attach the `ScrollNotifier` `scroll` listener with `{passive: true}`, coalesce offset updates inside `requestAnimationFrame`, and notify listeners only when active scroll IDs change.
- Replace per-code-block `@client` `CopyButton` islands in `WrappedCodeBlock` and `DownloadableSnippet` with server-rendered `CodeBlockCopyButton` elements backed by a single delegated document click listener across `docs.flutter.dev` (`3,335` islands removed) and `flutter.dev` (`785` islands removed).
There was a problem hiding this comment.
Code Review
This pull request introduces a new CodeBlockCopyButton component to replace the existing copy button, updates the ResizingAssetTransformer to support WebP and handle animated thumbnails, and implements lazy reCAPTCHA loading for the newsletter form. The review identified several technical issues, including a compilation error in the image resizing test, missing unawaited annotations for asynchronous calls in violation of the style guide, a type mismatch in the scroll spy utility, and a state management issue in the newsletter form where asynchronous updates were not wrapped in setState.
|
Staged preview of the updated docs.flutter.dev site (updated for commit b3c66b7): https://flutter-docs-prod--docs-pr14103-gsc-perf-4ykr9ios.web.app |
|
Staged preview of the updated flutter.dev site (updated for commit b3c66b7): https://flutter-dev-230821--www-pr14103-gsc-perf-seft11a9.web.app |
- Adds explanatory comments on detached unawaited futures in newsletter_form.dart and web_code_block_copy.dart, dropping @awaitNotRequired to satisfy unnecessary_unawaited.
- Wrap `web.Element.remove` in a closure inside `web_code_block_copy_browser_test` so `dart2js` and `dart2wasm` do not fail on tearing off an external JS interop extension-type member, and add Chrome click-delegation tests. - Replace text-button content during copy feedback instead of appending `.copy-feedback` alongside existing `buttonText`, and hoist `_handleCopy` to keep cognitive complexity low. - Decode resized images with a fresh `Decoder` instance after the header width check so stateful decoders such as `PngDecoder` do not duplicate chunk and frame lists. - Delegate `ScrollNotifier._syncTargets` state updates to `applyThresholds` and remove failed reCAPTCHA `<script>` elements before retry.
Cuts mobile image payload, startup script blocking, scroll jank, and client
island hydration across
flutter.devanddocs.flutter.dev.ResizingAssetTransformer: Decodes and re-encodes.webpinputs viapackage:imageinstead of returning originals untouched,preserving lossless WebP when lossless and extracting the composited poster
frame for animated WebP thumbnails (
11.38 MBto56.4 KB,-99.5%, acrossthe 3 homepage news cards;
60resized.webpoutputs total).ScrollNotifier: Removes synchronous<script src="https://www.google.com/recaptcha/api.js">(~360 KB) fromNewsletterSectionin favor of loadingrecaptcha/api.js?render=explicitonfirst input focus, and coalesces passive
{passive: true}scroll checksinside
requestAnimationFrame.@clientCopyButtonislands with server-rendered buttons and a single document clicklistener (stripping
[aria-hidden="true"]prompt and fold spans), removing3,335client islands acrossdocs.flutter.devand785acrossflutter.dev/blog(verified on Chrome JS anddart2wasm).Presubmit checklist
of 80 characters or fewer.