zth/rescript-relay-router

Update `Component` loading to `Script` loading

Kingdutch opened this issue · 2 comments

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

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

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.