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 MessageDebugger.tsx for react-compiler
Eric Roberts
2026-11-10T17:33:57ZThe compiler can't handle throwing inside try/catch:
(BuildHIR::lowerStatement) Support ThrowStatement inside of try/catch
They don't support this because they think you shouldn't do it:
> /*
> * NOTE: we could support this, but a `throw` inside try/catch is using exceptions
> * for control-flow and is generally considered an anti-pattern. we can likely
> * just not support this pattern, unless it really becomes necessary for some reason.
> */
https://github.com/react/react/blob/main/compiler/packages/babel-plugin-react-compiler/src/HIR/BuildHIR.ts#L281-L285
Weird choice IMO but whatever.
Moved to a function outside the component.
Semantic diff summary
1 added,
2 modified,
0 signature changed,
0 removed
across 2 analyzed files
+0
-1
scripts/compiler.test.mjs
#
+21
-13
src/components/MessageDebugger.tsx
#
| ... | ... | @@ -25,6 +25,26 @@ function exposeMessage(message: ChatMessage) { | |
| 25 | 25 | console.log(`${name} (window.${name})`, message); | |
| 26 | 26 | } | |
| 27 | 27 | ||
| 28 | + | async function lookupAndExposeMessage( | |
| 29 | + | persistence: Persistence, | |
| 30 | + | m: ChatMessage, | |
| 31 | + | serverId: string, | |
| 32 | + | ) { | |
| 33 | + | try { | |
| 34 | + | const message = await persistence.getMessage( | |
| 35 | + | m.account(), | |
| 36 | + | m.chatId(), | |
| 37 | + | serverId, | |
| 38 | + | null, | |
| 39 | + | ); | |
| 40 | + | if (!message) | |
| 41 | + | throw new Error(`No stored message for server ID ${serverId}`); | |
| 42 | + | exposeMessage(message); | |
| 43 | + | } catch (error) { | |
| 44 | + | console.error("Message debugger lookup failed", serverId, error); | |
| 45 | + | } | |
| 46 | + | } | |
| 47 | + | ||
| 28 | 48 | export const MessageDebugger = ({ m }: { m: ChatMessage }) => | |
| 29 | 49 | debugEnabled ? <MessageDebuggerButton m={m} /> : null; | |
| 30 | 50 |
| ... | ... | @@ -52,19 +72,7 @@ const MessageDebuggerButton = ({ m }: { m: ChatMessage }) => { | |
| 52 | 72 | } | |
| 53 | 73 | clearTimeout(feedbackTimer.current); | |
| 54 | 74 | feedbackTimer.current = setTimeout(() => setFeedback(""), 1000); | |
| 55 | - | try { | |
| 56 | - | const message = await persistence.getMessage( | |
| 57 | - | m.account(), | |
| 58 | - | m.chatId(), | |
| 59 | - | serverId, | |
| 60 | - | null, | |
| 61 | - | ); | |
| 62 | - | if (!message) | |
| 63 | - | throw new Error(`No stored message for server ID ${serverId}`); | |
| 64 | - | exposeMessage(message); | |
| 65 | - | } catch (error) { | |
| 66 | - | console.error("Message debugger lookup failed", serverId, error); | |
| 67 | - | } | |
| 75 | + | await lookupAndExposeMessage(persistence, m, serverId); | |
| 68 | 76 | }} | |
| 69 | 77 | > | |
| 70 | 78 | {serverId} |