cheogram-www

created pr with cheogram-www/react-compiler-fixes.1 on 2026-11-10T18:57:22Z · by 3c31bc8c
commented on 2026-11-10T18:57:22Z · by 3c31bc8c
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 -3
checkout specific patchset revision:
ssh pr.pico.sh pull cheogram-www:react-compiler-fixes [rev] | git am -3
add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh cheogram-www:react-compiler-fixes
add comment to patch request:
ssh pr.pico.sh comment cheogram-www:react-compiler-fixes "lgtm!"

Patchset cheogram-www/react-compiler-fixes.1 on 2026-11-10T18:57:22Z · commit 638784e

Fix Account.tsx for react-compiler
Eric Roberts 2026-11-10T17:23:58Z
The 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 #
......@@ -4,7 +4,6 @@ import { test } from "node:test";
44 import { createServer } from "vite";
55
66 const compilerSkips = new Set([
7- "components/Account.tsx",
87 "components/Accounts.tsx",
98 "components/Chat.tsx",
109 "components/Chats.tsx",
+32 -20 src/components/Account.tsx #
......@@ -37,6 +37,27 @@ import { AvatarWithPlaceholder } from "./AvatarWithPlaceholder";
3737 import { AwaitOnce } from "./AwaitOnce";
3838 import { EditableProfile } from "./EditableProfile";
3939 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+}
4061
4162 const timeInFuture = (seconds: number) => {
4263 return new Date(new Date().getTime() + seconds * 1000).toLocaleString([], {
......@@ -151,7 +172,7 @@ export const Account = () => {
151172 onClose={() => setStatusPopover(null)}
152173 >
153174 <Picker
154- data={async () => ({ ...(await import("@emoji-mart/data")) })}
175+ data={loadEmojiData}
155176 categories={[
156177 "frequent",
157178 "activity",
......@@ -308,7 +329,7 @@ export const Account = () => {
308329 activeImporter.onMessage = (source, item) => {
309330 if (!importSettingsRef.current.archive) return;
310331
311- count++;
332+ count += 1;
312333 if (count % 1000 == 0) {
313334 console.log(count);
314335 console.timeLog("import");
......@@ -353,24 +374,15 @@ export const Account = () => {
353374 passwords: [password],
354375 });
355376
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;
374386 }
375387 // Anything left in the batch to commit
376388 await persistence.storeMessages(
+4 -0 src/util.ts #
......@@ -7,6 +7,10 @@ import { useRef, useCallback, useEffect, useSyncExternalStore } from "react";
77 export const serviceWorker = isTauri() ? undefined : navigator.serviceWorker;
88 export const readyServiceWorker = serviceWorker?.ready ?? Promise.resolve(null);
99
10+export const loadEmojiData = async () => ({
11+ ...(await import("@emoji-mart/data")),
12+});
13+
1014 export const ios = navigator.userAgent.match(/(iPad|iPhone|iPod)/g);
1115 export const webkit =
1216 navigator.userAgent.match(/AppleWebKit/) &&
Back to top