add comment

This commit is contained in:
peterkogo
2025-03-27 12:03:47 +01:00
parent 9be5276069
commit 3ac2846d5e
+6 -2
View File
@@ -45,7 +45,7 @@ const createStore = ({
async function resolveFitView() {
const { nodeLookup, panZoom, fitViewOptions, fitViewResolver, width, height, minZoom, maxZoom } = get();
if (!panZoom) {
if (!panZoom || !fitViewResolver) {
return;
}
@@ -61,7 +61,11 @@ const createStore = ({
fitViewOptions
);
fitViewResolver?.resolve(true);
fitViewResolver.resolve(true);
/**
* wait for the fitViewport to resolve before deleting the resolver,
* we want to reuse the old resolver if the user calls fitView again in the mean time
*/
set({ fitViewResolver: null });
}