TanStack / router

🤖 Fully typesafe Router for React (and friends) w/ built-in caching, 1st class search-param APIs, client-side cache integration and isomorphic rendering.
https://tanstack.com/router
MIT License
8.13k stars 630 forks source link

Proper handling of multiple setCookie calls #2680

Open ondrejvelisek opened 5 days ago

ondrejvelisek commented 5 days ago

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

Dont have time now to provide. Im in hurry. Sorry. Will provide if needed.

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

Additional context

No response

SeanCassiere commented 4 days ago

Please attach a reproduction.