fix(fitView): handle uncontrolled flows
This commit is contained in:
@@ -45,7 +45,7 @@ const createStore = ({
|
|||||||
async function resolveFitView() {
|
async function resolveFitView() {
|
||||||
const { nodeLookup, panZoom, fitViewOptions, fitViewResolver, width, height, minZoom, maxZoom } = get();
|
const { nodeLookup, panZoom, fitViewOptions, fitViewResolver, width, height, minZoom, maxZoom } = get();
|
||||||
|
|
||||||
if (!panZoom || !fitViewResolver) {
|
if (!panZoom) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ const createStore = ({
|
|||||||
fitViewOptions
|
fitViewOptions
|
||||||
);
|
);
|
||||||
|
|
||||||
fitViewResolver.resolve(true);
|
fitViewResolver?.resolve(true);
|
||||||
/**
|
/**
|
||||||
* wait for the fitViewport to resolve before deleting the resolver,
|
* 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
|
* we want to reuse the old resolver if the user calls fitView again in the mean time
|
||||||
@@ -89,6 +89,7 @@ const createStore = ({
|
|||||||
checkEquality: true,
|
checkEquality: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log(fitViewQueued, nodesInitialized);
|
||||||
if (fitViewQueued && nodesInitialized) {
|
if (fitViewQueued && nodesInitialized) {
|
||||||
resolveFitView();
|
resolveFitView();
|
||||||
set({ nodes, fitViewQueued: false, fitViewOptions: undefined });
|
set({ nodes, fitViewQueued: false, fitViewOptions: undefined });
|
||||||
|
|||||||
Reference in New Issue
Block a user