Expose Turbo Stream Plugins Options #14649
Replies: 2 comments 5 replies
-
|
This change will make turbo-stream not be an internal detail of RR anymore. In the future once RSC is stable and enabled always its streaming format should replace turbo-stream. If the plugin system is made open it will make it harder for apps to upgrade later. |
Beta Was this translation helpful? Give feedback.
-
|
Do you have a suggestion for handling Decimals that are used all throughout our code base and much of the time deeply nested? Or would you consider supporting the tc39 Decimal proposal instead of the exposing the plugin options? also the problem of serializing/deserializing decimals will still exist, correct? Or are you planning on exposing a plugin system for RSC’s like Next.js does? Basically will there be some way of dealing with this in RSC that will be better, or will this always be a problem. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
It would be really great if we could do something like:
and pass our own decoders/encoders to turbo-stream.
There was a previous discussion that I cannot find where the answer was that loaders are going away because of RSC which would handle types like Decimal, but the docs say that there are only plans to support the types supported by RSC, so it doesn't look like RSC will have an answer for this.
Eventually, decimal might become a javascript primitive, but until then, we have to either:
Along with the SerializesTo type:
This is great, but we have to maintain the patch every time a new react router version comes out.
or
loader/useLoaderDatafunctions. This adds noise to the codebase and is inefficient and provides no assurance that what you're decoding is actually aDecimal.I've tried lots of workarounds, but there's really no way to achieve this without maintaining a fork or a patch.
Is there any chance the React Router team might reconsider exposing turbostream plugins?
If the problem is opening yourself up to any plugin being added, maybe the tc39-compatible Decimal polyfill would be an option: https://github.com/yukinotech/JSBD
Because it is just exposing what could eventually be part of the JS spec and could be enabled with an unstable feature flag?
Beta Was this translation helpful? Give feedback.
All reactions