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

Feature: Add toJSON so that Signal.State (no matter where it exists in a bigger structure) behaves well with JSON.stringify #162

Closed
wants to merge 2 commits into from

Conversation

NullVoxPopuli
Copy link
Collaborator

title.

Idk if folks would want more information included, but I think this makes sense -- it's a reactive version of a value, and this toJSON implementation essentially just unwraps that which JSON doesn't care about

@@ -188,7 +204,7 @@ describe("Watcher", () => {
// Adding any other effect after an unwatch should work as expected
const destructor2 = effect(() => {
output = stateSignal.get();
return () => {};
return () => { };
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apologies -- my prettier plugin considers the existence of package.json as "when to enable prettier" :(

stevearc/conform.nvim#268

I've opened this as well: #163

Copy link
Member

@littledan littledan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not really sure if we should be encouraging this treatment of signals as identifying with their contents, or other lossy by-default toJSON transforms generally; can we discuss this in an issue first?

@NullVoxPopuli
Copy link
Collaborator Author

roger roger

#164

@WebReflection
Copy link

I've reasoned here why this is a terrible idea if the subscription happens out of the box: #164 (comment)

@NullVoxPopuli NullVoxPopuli deleted the add-toJSON branch April 12, 2024 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants