Skip to content

side effects of server functions always re-rendering server components #793

@jldec

Description

@jldec

Unlike nextjs, rwsdk server functions always re-render all server components on the page when a server function is invoked.

This may have unintended side-effects e,g, when server-rendering is not idempotent. E.g. If the page is rendered from a server-side data stream, that stream will be regenerated or refetched which may not be the desired behavior.

To illustrate this, try visiting the following 2 pages, and clicking on the button.

(note that safari won't stream on the initial page load, but other browsers will)

My suggestion, would be to make this behavior opt-in (or opt-out) for server functions, instead of always re-rendering all the server components on the page.

nextjs.mov
rwsdk.mov

Metadata

Metadata

Assignees

No one assigned

    Labels

    1.xIssues planned for a minor release after 1.0

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions