DioxusLabs / DioxusLabs/dioxus

serde for `Store`s

Open
#5,784 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
39.1k
Forks
1.9k
Avg merge
4d 10h
Merged PRs (30d)
4

Description

## Feature Request

`Signal`s do support serde for `T: serde`
but I couldn't find any equivalent for `Store`s

## Implement Suggestion

here is Signal's current implementation : https://github.com/DioxusLabs/dioxus/blob/e2cc82e63f3f44f92dfddbae8c6b4dde2d65d1e8/packages/signals/src/signal.rs#L500-L516

I assume it would go the same way for `Store`s,
as it's pretty much literally a like `Signal` from the `read`/`new` api pov.

I can send a PR with it, if there aren't other subtleties arising from this change, please let me know.

## slightly unrelated, but that's what brought me here

might be some kind of XY problem,

I realized serde was missing from `Store`s when I wanted to use `dioxus_sdk`'s [`use_storage`](https://github.com/DioxusLabs/sdk/blob/551cd800827dbc330876511737226cc894f7aae7/packages/storage/src/lib.rs#L73) with a `Store`.
I know that `use_storage` gives a `Signal`, but I needed a `Store` to access my Type's Lenses...
I'm pretty sure there might be a way to convert the `use_storage`'s `Signal` into a `Store` without having nested `Signal>`, while keeping the Store reactively updating the storage, but I couldn't figure it out...

Thanks forward

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the serde implementation in packages/signals/src/signal.rs at the linked lines, then locate the corresponding Store implementation in the signals package. Compare Store's read/new API and the dioxus_sdk storage integration in packages/storage/src/lib.rs; done means Store supports serde for serializable T without changing the existing Signal behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.