Closed marilari88 closed 3 months ago
Was looking for a way to share a reproducible bug in zod in a bug report. Having a way to capture schema and input in a shareable URL would be great!
imho, leave dbs aside and keep it a spa app. I'm preparing a pr for this, shouldn't be that hard to serialize the schema in the url!
I'm working on it 🙂
I looked at this task before and I agree there are no concerns about the url length limitation. By relying to the search params we make the actual state reduntant, and as consequence some refactoring is unavoidable Considering I already started working on it, I'll be happy to receive your review @giacomocerquone
I looked at this task before and I agree there are no concerns about the url length limitation. By relying to the search params we make the actual state reduntant, and as consequence some refactoring is unavoidable Considering I already started working on it, I'll be happy to receive your review @giacomocerquone
Ok, it makes sense. I'll have a look at it then.
I'm a bit concerned about what you said, though. The state is not redundant, the URL has to be treated as an initial value of the internal state. They're two different things, and the state should stay.
Some other things I thought about:
Some other things I thought about:
- I've read that there is a current limit of 2.048 characters to be used in the URL. While this might not be problematic, think about showing up a warning (modal) if the schema is longer than that.
- Also, should we also share the value? It might be useful, and it would be weird to only share the schema if a particular value is needed to test it out.
- Lastly, we could use GitHub auth and gists to share the value. It should be possible to do everything without hosting a server
So, the plan is as follows:
For this purpose we could move the state to the URL query strings or alternatively rely on a database: the first option is less complicated but implies to implement an escaping/encoding phase when write/read the url and we must ensure the URL can contain the whole state Additionally we could evaluate if add a proper share button/menu makes sense