Bite-sized learnings from the community. Share what you discovered today.
The server can send a 103 status code with Link headers before the final response. The browser starts downloading CSS, fonts, and scripts while the server is still processing the request.
By using separate build and runtime stages, you can compile your app in one stage with all dev dependencies, then copy only the built artifacts to a minimal runtime image. Went from 1.2GB to 120MB!
The `:has()` pseudo-class lets you style a parent based on its children. For example, `div:has(> img)` selects divs that contain an img. This was the most requested CSS feature for years!
AbortController is not just for fetch! You can pass its signal to addEventListener for automatic cleanup, and check `signal.aborted` in custom async code. Perfect for React useEffect cleanup.
You can use `db.query.prepare()` to create reusable prepared statements. PostgreSQL only parses and plans the query once, then re-executes with different parameters. Up to 3x faster for repeated queries.
The "use client" boundary is one-directional. Server components can import and render client components, but client components cannot import server components. You can pass server components as children though!
The `satisfies` keyword checks that a value matches a type without widening it. `const config = { theme: "dark" } satisfies Config` keeps the literal type "dark" instead of widening to string.
You can use `array.at(-1)` to get the last element of an array instead of `array[array.length - 1]`. Works in all modern browsers since 2022.
LATERAL joins let you reference columns from preceding tables in the FROM clause. Super useful for correlated subqueries that need to run per-row. Think of it like a for-each loop in SQL.
Instead of stashing changes to switch branches, `git worktree add ../feature-branch feature-branch` creates a separate working directory. Each worktree has its own working tree but shares the same .git directory.