Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server Islands fails when an object with circular dependencies passed as a prop. #11969

Closed
1 task
Mouaz opened this issue Sep 11, 2024 · 5 comments
Closed
1 task
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) feat: server islands Related to Server Islands (scope)

Comments

@Mouaz
Copy link

Mouaz commented Sep 11, 2024

Astro Info

Astro                    v4.15.4
Node                     v20.12.2
System                   macOS (arm64)
Package Manager          bun
Output                   hybrid
Adapter                  @astrojs/node
Integrations             @astrojs/react
                         astro-icon

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

Passing an object with circular references to a server Island causes since safeJsonStringify doesn't take circular references in consideration.
image

What's the expected result?

Circular objects to be delivered as they are to the client.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-ldsng3?file=src%2Fpages%2Findex.astro

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Sep 11, 2024
@Princesseuh Princesseuh added - P3: minor bug An edge case that only affects very specific usage (priority) feat: server islands Related to Server Islands (scope) and removed needs triage Issue needs to be triaged labels Sep 11, 2024
@ascorbic
Copy link
Contributor

ascorbic commented Sep 13, 2024

Maybe we should use devalue to serialise the data. That would allow Map and Set too and remove the need for the XSS prevention magic

@matthewp
Copy link
Contributor

We went through all of these types of things with client islands and it causes more problems than it fixes I think. Also if we used something like devalue we need to both serialize and deserialize it. I personally think it's better just to document the limitation.

@bluwy
Copy link
Member

bluwy commented Sep 19, 2024

There was an attempt to fix this in the past: #8004

@ematipico
Copy link
Member

ematipico commented Sep 19, 2024

I am up for documenting the limitation.

@ascorbic
Copy link
Contributor

ascorbic commented Oct 4, 2024

Closing this in favour of a docs issue: withastro/docs#9557

@ascorbic ascorbic closed this as not planned Won't fix, can't repro, duplicate, stale Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) feat: server islands Related to Server Islands (scope)
Projects
None yet
Development

No branches or pull requests

6 participants