fix(modal): close rollout and async lifecycle gaps
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5375ad6429
commit
aa865e24e1
8 files changed
+86
-31
No files matched your search
@@ -342,11 +342,12 @@
|
||||
},
|
||||
};
|
||||
|
||||
session.flight = cacheable
|
||||
var flight = cacheable
|
||||
? cache.acquire(cacheKey, request, acquireOptions)
|
||||
: { promise: request(), release: function () {} };
|
||||
session.flight = flight;
|
||||
|
||||
return session.flight.promise.then(function (result) {
|
||||
return flight.promise.then(function (result) {
|
||||
if (!session.closed && active === session) renderResult(session, result);
|
||||
return session.shell;
|
||||
}).catch(function (error) {
|
||||
@@ -354,8 +355,12 @@
|
||||
if (!aborted && !session.closed && active === session) renderError(session, error);
|
||||
return session.shell;
|
||||
}).then(function (shell) {
|
||||
if (session.flight && typeof session.flight.release === "function") session.flight.release();
|
||||
session.flight = null;
|
||||
// A refresh/replacement may have installed a newer flight on this session.
|
||||
// Only the owner of this promise may release and clear the slot.
|
||||
if (session.flight === flight) {
|
||||
if (flight && typeof flight.release === "function") flight.release();
|
||||
session.flight = null;
|
||||
}
|
||||
return shell;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user