Skip to content

v0.2.4

Choose a tag to compare

@shivamsn97 shivamsn97 released this 21 Apr 06:52
· 40 commits to main since this release
81e73ee

Pyxle Kit (the new pyxle/client reference demo) exercises every
client component in one place, so this release implements or
hardens the ones that were still stubs or racy on hydration.

Highlights

SSR pathname plumbing

The worker pool now propagates the request path into the Node SSR
runtime, which sets globalThis.__PYXLE_CURRENT_PATHNAME__ for the
duration of the render. This eliminates:

  • hydration mismatches on usePathname() (e.g. active-link highlighting)
  • <Form> / useAction action-URL mismatches between SSR and client

Client components

  • <Head> — client useEffect rewrite. Adopts SSR-rendered head
    nodes by key attribute (no duplicates on hydration), restores the
    previous <title> on unmount.
  • <Script> — full implementation, not a stub. Strategies
    afterInteractive (default), lazyOnload, and beforeInteractive;
    module-level promise dedup; cooperation with bootstrap-preloaded
    scripts; onLoad / onError; inline children via script.textContent.
  • <Image>placeholder=\"blur\" with blurDataURL or
    placeholderColor, fallbackSrc for graceful recovery on broken
    primary src, onLoad / onError with cache-hit detection, and a
    data-pyxle-image-state attribute for CSS-only fade transitions.
    Also fixes a hydration race: a terminal-error on an SSR-rendered
    src (e.g. a 404 avatar) is now recovered via the post-mount
    complete && naturalWidth === 0 check, so fallbackSrc kicks in
    even when the native error event fired before React hydrated.
  • usePathname() — reads the SSR pathname global so the first
    client render matches SSR, then subscribes to framework navigation
    events for reactive updates.

Documentation

Resolved the 8-item docs/framework parity audit:

  • Documented usePathname() in reference/client-api.md
  • Removed stale dev:css / build:css references across quick-start,
    project-structure, faq, deployment, and the pyxle init hint — the
    scaffold's actual flow is PostCSS-via-Vite, auto-run by pyxle dev
  • Updated the quick-start landing-page description and the
    project-structure loader example to match the scaffold's real output
  • Added source_absolute_path, content_hash, and head_elements to
    the RouteContext table in the middleware guide
  • Clarified the pyxle build chain description in the deployment guide

Tests

1141 passing (+14 new).