Skip to content

Start: createServerFn cannot return null #2776

Closed

Description

@SeanCassiere

Which project does this relate to?

Router

Describe the bug

All details are found in this discussion thread on Discord - https://discord.com/channels/719702312431386674/1306957125246914590

The crust of the matter is that you aren't able to return null from a createServerFn call.

const fn = createServerFn().handler(async () => {
    return null
})

await fn(); // undefined

Your Example Website or App

https://discord.com/channels/719702312431386674/1306957125246914590

Steps to Reproduce the Bug or Issue

Create a server function returning null and see that at runtime it does not return the value, instead, it returns undefined.

Expected behavior

The returned null value from the server function should correctly get piped down to the caller.

Screenshots or Videos

No response

Platform

N/A

Additional context

No response

Activity

  1. added
    start
    information needed
    on Nov 15, 2024
  2. SeanCassiere commented on Nov 15, 2024

    @SeanCassiere
    MemberAuthor

    Need to investigate the issue.

    The issue/bug has been investigated and a reproduction has been created.

  3. removed
    information needed
    on Nov 16, 2024
  4. moved this from Backlog to Ready in Router/Start Roadmapon Nov 16, 2024
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

    start

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions