useOptimistic: React's official hook for optimistic updates inside an Action. Its setter must be called inside an Action. Calling it outside one produces a warning and shows the optimistic state only briefly.- If a project already uses TanStack Query, keep the existing
onMutateapproach. ReconsideruseOptimisticlater if the architecture moves toward Server Actions and form Actions.
Learnings
Small lessons captured before they become long-form writing
2026
- When a flex layout contains a long string,
overflow-wrap: anywhereavoids having to setmin-width: 0every time, unlikeoverflow-wrap: break-word. break-word: “Break it if it actually overflows.” The long word still contributes a large intrinsic size, so the text area cannot shrink enough.anywhere: “Break it anywhere if necessary.” The intrinsic-size calculation also accounts for possible breaks.
- When a flex layout contains a long string,
- On a MacBook, holding Option while dragging a window makes split-screen tiling easy. Dragging a window into a corner also creates a four-way split.
- AST: Abstract Syntax Tree
- How was the code written? Syntax-oriented. Used by linters, formatters, and similar tools.
- HIR: High-level Intermediate Representation
- What does the code mean at the language level? Removes syntactic sugar and focuses on semantics.
- MIR: Mid-level Intermediate Representation
- What control flow does the program have? Execution-oriented.
- AST, HIR, and MIR are not universal fixed stages shared by every compiler. Their exact boundaries and responsibilities differ between compilers.
no-extra-boolean-cast- Do not use
!!,Boolean(), or another unnecessary cast in a context that already evaluates a value as boolean. - Disallow unnecessary boolean casts.
- Do not use
strict-boolean-expressions- Do not depend on implicit truthy/falsy conversion in a boolean context; test explicitly. (e.g. Don't:
if (name), Do:if (name !== "")) - Forbids usage of non-boolean types in expressions where a boolean is expected. Boolean and never types are always allowed. Additional types considered safe in a boolean context can be configured through options.
- Do not depend on implicit truthy/falsy conversion in a boolean context; test explicitly. (e.g. Don't:
- TypeScript does not aim to “Apply a sound or ‘provably correct’ type system.” Instead, its goal is to “strike a balance between correctness and productivity.”
- Claude retains sessions for 30 days. You can change the retention period with
cleanupPeriodDays. - Codex does not have a configured retention period.
- Claude retains sessions for 30 days. You can change the retention period with
- BAML stands for Basically A Made-up Language.
- In v0 it was a lightweight programming language that gave LLMs a type-safe interface for structured prompting. In v1, its scope expanded and it is introduced as a programming language for agents.