Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
tl;dr
This enables the caller to have more control over how and when the mapkit resources are loaded. Instead of supporting more API sruface area in mapkit-react library I thought it made sense to just hand over control at the load point as a "advanced use" option. This could lead to foot-guns if the caller doesn't load the necessary resources and then tries to use a component from the lib that depends on the missing resource. In this case the error messages should be clear enough (mapkit says the resrouce needs to be loaded when using associated APIs).
Needed this flexibility to support my own desires for optimizing map loading performance https://developer.apple.com/documentation/mapkitjs/loading_the_latest_version_of_mapkit_js#3331749.
My main driver was wanting to optimize map loading as much as possible rendering my own static script tag and using
async
andfetchpriority
attributes which aren't possible when loading the script on demand.