Skip to content

Proper handling of multiple setCookie calls #2680

Description

@ondrejvelisek

Which project does this relate to?

Start

Describe the bug

Hi,

Ive encountered an interesting problem.

I have server function which is setting a cookie via setCookie("user_preferences", "preference_value"). And Im calling this function from within loader multiple times.

It sets the set-cookie header in a very wierd way.

If called 4 times it includes 4 set-cookie headers and fifth set-cookie header with 4 values repeated. See screenshot.

Your Example Website or App

https://github.com/ondrejvelisek/start-basic/
(Open root route and check response headers)

Steps to Reproduce the Bug or Issue

Use multiple setCookie with same name in the route loader.

Expected behavior

I would expect TanStart to deduplicate and set just the last called value.

Screenshots or Videos

Image

Platform

  • OS: macOS
  • Browser: Chrome
  • Version: -

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