Skip to content

hydrate doesn't emit events initially #3810

Closed
@hiendv

Description

@hiendv

Which project does this relate to?

Start

Describe the bug

Unlike normal render which comes with router.load(), hydrate from @tanstack/start-client-core won't emit events like 'onLoad', 'onResolved' from router subscriptions when initially rendered.

In my scenario, I need to trigger an action once the router is loaded but the StartClient and hydrate won't allow it.

Your Example Website or App

https://github.com/hiendv/tanstack-start-hydrate-events

Steps to Reproduce the Bug or Issue

  1. Go to the reproduction repo
  2. Clone and pnpm install
  3. pnpm test
  4. This test fails: https://github.com/hiendv/tanstack-start-hydrate-events/blob/master/src/client.test.tsx
  5. This is the test for the workaround: https://github.com/hiendv/tanstack-start-hydrate-events/blob/master/src/client-promised.test.tsx

Expected behavior

As a user, I expect to be able to subscribe to events like normal router.load()

Screenshots or Videos

No response

Platform

  • OS: Ubuntu 24.04.2 LTS
  • Browser: Version 134.0.6998.88 (Official Build) (64-bit) / JSDOM / Happy DOM
  • Version:
    • @tanstack/start-client-core@1.114.25
    • @tanstack/react-router@1.114.25
    • react-dom@19.0.0
    • react@19.0.0

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    startEverything about TanStack Start

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions