Uncategorized

  • React 15 stateless components, and when they help

    A component that only renders props needs no class, no constructor and no lifecycle. Written as a function it is shorter and, more usefully, it cannot accidentally acquire…

  • flex-basis and the min-width: auto trap

    A flex item refuses to shrink below its content, because min-width defaults to auto on flex items rather than to zero. The symptom is a long word or…

  • position: sticky, and the ancestor that silently disables it

    position: sticky works or does nothing, with no error and no warning. Nearly always the cause is an ancestor rather than the element itself. The overflow rule is…

  • A shared database is coupling you cannot see

    Two services with their own repositories, deployments and teams still cannot change independently if they read the same tables. The dependency is real and invisible — nothing in…

  • register_rest_route needs the feature plugin until 4.7

    4.4 shipped the REST API infrastructure — the server, the routing, register_rest_route() — and none of the content endpoints. So the function exists on a stock install and…

  • A default export makes a rename silent

    A default export has no name at the boundary, so the importing file invents one. Rename the thing being exported and every import keeps working under the old…

  • Scalar type declarations are a per-file decision

    PHP 7 added scalar type hints and then made them optional in a way that surprises people: without declare(strict_types=1) the engine coerces, so a function typed int happily…

  • Set for deduplication, and where it quietly fails

    […new Set(values)] is the shortest deduplication in the language and it compares by identity, so it does nothing at all for a list of objects that happen to…

  • A generated column indexes a field inside JSON

    A JSON column cannot be indexed directly, so a query filtering on something inside it scans the table. A generated column extracts the value into a real column…

  • composer why explains a version you did not choose

    When Composer installs an old version of something you never asked for, the answer is always a transitive constraint — and reading composer.lock to find which package imposed…