Skip to content

WebSocket only #3521

Open
Open

Description

@Buom01

Is your feature request related to a problem? Please describe.
Using a WebSocket manager, it's getting ignored on SSR and fallback to REST, but my application is WebSocket only.

Describe the solution you'd like
I would like a solution to not provide data from SSR, just disabling REST and provide a Suspense until the client app got the data through the manager.
An other possibility is to allow managers on SSR.

Describe alternatives you've considered

Additional context
Using NextJS

Activity

  1. added
    enhancement
    on Jul 21, 2025
  2. ntucker commented on Jul 21, 2025

    @ntucker
    Collaborator

    The easiest way to this now is without suspense.

    If you use the normal DataProvider import { DataProvider } from '@data-client/react'; - it will still work with nextjs, and just not do any SSR.

    You can then useQuery() in your components with whatever Entity your WebSockets will send. Instead of suspense, you can simply check the return value for being undefined.

    const myData = useQuery(MyEntity, { id });
    if (!myData) return 'Loading...';
    // render myData

    This does have the downside of not centralizing loading states, and no concurrent transitions. However, usually in cases without REST APIs those things matter less to user experience.

    useSuspense() doesn't need REST - Endpoint it works with any promise; but you'd have to wire the promise resolution yourself, as this use case is not known to the library yet. However, if you elaborate on the details a design could be added. If so please add to the discussion around conditional suspense

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions