Code Loader - Load New/Latest
Whenever creating a new document, the flow currently works like this:
- Host creates detached container with code details (includes version)
- Code Loader loads that code
But that requires that the Host must figure out what version to propose, which is typically in the domain of the Code Loader. So either the Host must first ask the Code Loader implementation for the latest version available, or it must pass a placeholder version indicating to the Code Loader to load the latest.
It would be nice if there were an additional API in the Code Loader to either get the latest version given a package name, or maybe just "create new" flow to handle loading without a version, only a package name.
@heliocliu feel free to do with this what you want, @anthony-murphy recommended assigning to you since you might already be thinking in this area.
@ChumpChief thought you might be interested as well here. trying to think how we simplify what goes in createDetached, and let the code loader populate it. not sure if that's better or worse for what your thinking
@arinwt are there situations where the host explicitly determines that it doesn't want to load the latest version? from the description it sounds like it always wants the latest
Good point, no it doesn't necessarily always want the latest. It's just that it turns out to be a common case that we were thinking we might want to handle.
Couple thoughts:
-
If the host is unopinionated about the version to load, is it safe to assume we're talking about a scenario where the host is treating the container as a black box? If the host has significant interaction with the container I would suspect they'd want to be somewhat cautious about ensuring they've tested for the code version used, etc.
-
More generally, it seems to me the host may either (a) have its own opinions about the specific code to use or (b) delegate that responsibility to some external logic. Maybe (b) is the code loader, or maybe it's some other service, etc. So from a layering perspective, as long as we preserve that extensibility point for the host to be specific/explicit about the code used in (a), convenience on top seems fine. Or more practically, I think this "load latest version" behavior should probably only be triggered/configured from the host or other layers "above" the code loader, and never from within the runtime.
those are great points. Potentially there is no change here other than maybe defining a pattern. To mee this seems somewhat like createCreateNewRequest which is implemented by most url resolvers, but isn't on any interface. The reason it can't be on any interface is we have no idea what a driver needs to create a new file, for instance something like odsp need site, drive, path, and file name, whereas something like r11s just needs tenant and doc id. The assumption is the host needs to implement some kind of create new experience that knows about the drivers it supports and can uses those methods as convenience to implement those experiences and connect them to fluid. Code loaders could follow a similar pattern, e.g. createCodeDetailsForCreate or somthing. This could take things like container package name so the code loader can get the right code details for that experience, it's up to the code loader if this is latest, cached, or some specific version. this version is then given back to the code loader on load which gives it some control over perf across this (caching), but also ensure it's invariants are met so things like compare and satisfies on those code details make sense to it later one
This issue has been automatically marked as stale because it has had no activity for 180 days. It will be closed if no further activity occurs within 8 days of this comment. Thank you for your contributions to Fluid Framework!