zth / rescript-relay-router

MIT License
16 stars 3 forks source link

Update `Component` loading to `Script` loading #54

Closed Kingdutch closed 2 years ago

Kingdutch commented 2 years ago

Problem

We have some code which deals with Component loading, which makes sense because it originates from lazy loading components. However, with our new and improved set-up there's nothing that mandates it's specifically a Component and we're more dealing with Scripts's where the underlying preloading of components already keeps track of what scripts are needed.

Solution

Update the API to refer to Script instead of Component so it's clearer for consumers that this is generic and not specialized.

zth commented 2 years ago

I don't think we should do this. Instead I think we should add another member to the variant called Script which can deal with generic loading of scripts that aren't components. And that can take whatever conf is needed for loading a generic script (async or not, the type, etc).

Component gives us enough information to always configure loading/preloading correctly. We know it's a module etc. So still think it's specialized.

zth commented 2 years ago

Closing this for now, as I believe we kind of discussed this in a recent PR. We'll revisit as we add built-in support for more asset types.