cheogram-www
created pr with
cheogram-www/react-compiler-fixes.1
commented
Changes are available at https://tangled.org/mrry.band/cheogram-www on branch react-compiler-fixes.
cmds
checkout latest patchset:
ssh pr.pico.sh pull cheogram-www:react-compiler-fixes | git am -3checkout specific patchset revision:
ssh pr.pico.sh pull cheogram-www:react-compiler-fixes [rev] | git am -3add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh cheogram-www:react-compiler-fixesadd comment to patch request:
ssh pr.pico.sh comment cheogram-www:react-compiler-fixes "lgtm!"
Patchset
cheogram-www/react-compiler-fixes.1
Test each file for compilability
Eric Roberts
→ Fix Account.tsx for react-compiler
2026-11-10T17:11:18ZEric Roberts
Fix Accounts.tsx for react-compiler
2026-11-10T17:23:58ZEric Roberts
Fix Chat.tsx for react-compiler
2026-11-10T17:26:31ZEric Roberts
Fix Chats.tsx for react-compiler
2026-11-10T17:29:12ZEric Roberts
Fix Login.tsx for react-compiler
2026-11-10T17:32:03ZEric Roberts
Fix MessageDebugger.tsx for react-compiler
2026-11-10T17:33:10ZEric Roberts
Fix MessageMenuInChat.tsx for react-compiler
2026-11-10T17:33:57ZEric Roberts
Fix Quill.tsx for react-compiler
2026-11-10T17:34:29ZEric Roberts
Fix Register.tsx for react-compiler
2026-11-10T17:35:10ZEric Roberts
2026-11-10T17:36:03Z
Fix Account.tsx for react-compiler
Eric Roberts
2026-11-10T17:23:58ZThe compiler reported three unsupported constructs:
(BuildHIR::lowerExpression) Handle Import expressions
(BuildHIR::lowerExpression) Handle UpdateExpression to variables
captured within lambdas.
(BuildHIR::lowerStatement) Handle for-await loops
- Move the emoji loader to util because other places are going to use it
later.
- Replace count++ with count += 1 in the import callback
- Move the streaming loop into a separate function importChunks
Semantic diff summary
1 added,
5 modified,
0 signature changed,
0 removed
across 3 analyzed files
+0
-1
scripts/compiler.test.mjs
#
+32
-20
src/components/Account.tsx
#
| ... | ... | @@ -37,6 +37,27 @@ import { AvatarWithPlaceholder } from "./AvatarWithPlaceholder"; | |
| 37 | 37 | import { AwaitOnce } from "./AwaitOnce"; | |
| 38 | 38 | import { EditableProfile } from "./EditableProfile"; | |
| 39 | 39 | import { confirmDialog } from "./ConfirmDialog"; | |
| 40 | + | import { loadEmojiData } from "../util"; | |
| 41 | + | ||
| 42 | + | async function importChunks( | |
| 43 | + | data: AsyncIterable<string> | Iterable<string>, | |
| 44 | + | importer: borogove.Importer, | |
| 45 | + | settings: { readonly current: { archive?: boolean } }, | |
| 46 | + | wait: { readonly current: { p: Promise<boolean> } }, | |
| 47 | + | ): Promise<"completed" | "cancelled"> { | |
| 48 | + | for await (const chunk of data) { | |
| 49 | + | if (settings.current.archive === undefined) { | |
| 50 | + | for (let i = 0; i < chunk.length; i++) { | |
| 51 | + | importer.write(chunk.slice(i, i + 1)); | |
| 52 | + | if (!(await wait.current.p)) return "cancelled"; | |
| 53 | + | } | |
| 54 | + | } else { | |
| 55 | + | importer.write(chunk); | |
| 56 | + | } | |
| 57 | + | if (!(await wait.current.p)) return "cancelled"; | |
| 58 | + | } | |
| 59 | + | return "completed"; | |
| 60 | + | } | |
| 40 | 61 | ||
| 41 | 62 | const timeInFuture = (seconds: number) => { | |
| 42 | 63 | return new Date(new Date().getTime() + seconds * 1000).toLocaleString([], { |
| ... | ... | @@ -353,24 +374,15 @@ export const Account = () => { | |
| 353 | 374 | passwords: [password], | |
| 354 | 375 | }); | |
| 355 | 376 | ||
| 356 | - | for await (const chunk of data) { | |
| 357 | - | if (importSettingsRef.current.archive === undefined) { | |
| 358 | - | for (let i = 0; i < chunk.length; i++) { | |
| 359 | - | activeImporter.write(chunk.slice(i, i + 1)); | |
| 360 | - | const keepGoing = await importWaitRef.current.p; | |
| 361 | - | if (!keepGoing) { | |
| 362 | - | setImporter(null); | |
| 363 | - | return; | |
| 364 | - | } | |
| 365 | - | } | |
| 366 | - | } else { | |
| 367 | - | activeImporter.write(chunk); | |
| 368 | - | } | |
| 369 | - | const keepGoing = await importWaitRef.current.p; | |
| 370 | - | if (!keepGoing) { | |
| 371 | - | setImporter(null); | |
| 372 | - | return; | |
| 373 | - | } | |
| 377 | + | const result = await importChunks( | |
| 378 | + | data, | |
| 379 | + | activeImporter, | |
| 380 | + | importSettingsRef, | |
| 381 | + | importWaitRef, | |
| 382 | + | ); | |
| 383 | + | if (result === "cancelled") { | |
| 384 | + | setImporter(null); | |
| 385 | + | return; | |
| 374 | 386 | } | |
| 375 | 387 | // Anything left in the batch to commit | |
| 376 | 388 | await persistence.storeMessages( |
+4
-0
src/util.ts
#
| ... | ... | @@ -7,6 +7,10 @@ import { useRef, useCallback, useEffect, useSyncExternalStore } from "react"; | |
| 7 | 7 | export const serviceWorker = isTauri() ? undefined : navigator.serviceWorker; | |
| 8 | 8 | export const readyServiceWorker = serviceWorker?.ready ?? Promise.resolve(null); | |
| 9 | 9 | ||
| 10 | + | export const loadEmojiData = async () => ({ | |
| 11 | + | ...(await import("@emoji-mart/data")), | |
| 12 | + | }); | |
| 13 | + | ||
| 10 | 14 | export const ios = navigator.userAgent.match(/(iPad|iPhone|iPod)/g); | |
| 11 | 15 | export const webkit = | |
| 12 | 16 | navigator.userAgent.match(/AppleWebKit/) && |