Skip to content
This repository has been archived by the owner on Nov 23, 2023. It is now read-only.

Revise URMA Rendering Options #24

Open
2 tasks done
reconbot opened this issue Jun 25, 2022 · 5 comments
Open
2 tasks done

Revise URMA Rendering Options #24

reconbot opened this issue Jun 25, 2022 · 5 comments
Labels
enhancement New feature or request

Comments

@reconbot
Copy link
Contributor

reconbot commented Jun 25, 2022

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the feature has not already been requested

🚀 Feature Proposal

I was reading the rendering options and was wondering if they were exclusive of eachother? And if so maybe they should be a string union or enum?

Motivation

Prevents impossible states from happening.

Example

interface RouteModule {
  renderingMode?: 'server' | 'client' | 'isomorphic' // default is isomophic
  streaming?: boolean
  generated?: boolean // I noticed this wasn't documented
}
@galvez
Copy link
Member

galvez commented Jun 25, 2022

Hey there! Yeah, I thought about using an enum but I feel setting flags to booleans is more developer friendly than assigning strings to a single property? Maybe it's just me, just a perception — but it might be the case that we have a mode property as an alternative to the boolean flags? WDYT?

@galvez
Copy link
Member

galvez commented Jun 25, 2022

The generated flag is for SSG, which I'm adding support for in the next cycle.

@reconbot
Copy link
Contributor Author

I think with typescript or js with an editor that understands types it's really easy to autocomplete the strings and typecheck if you make a typo etc.

I think having both is a bad idea for the same reasons having having multiple booleans that represent the same thing is a bad idea. It's possible to represent a bad state even if you typecheck.

I was on the fence if "streaming" is part of "renderingMode" because I'm not sure if "streaming" is relevant for client side rendering or not. (I think it is or could be one day?)

@galvez
Copy link
Member

galvez commented Jun 25, 2022

You do make a compelling argument, sir. I'm tempted to make this change for 0.3 onwards.

@dac09
Copy link

dac09 commented Jul 4, 2022

+1 on this. I came here to say exactly the same. It's also much easier to reason at a glance how a route would be rendered!

@galvez galvez changed the title URMA Rendering Options have an impossible state. Revise URMA Rendering Options Jul 10, 2022
@galvez galvez added the enhancement New feature or request label Jul 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants