Merge pull request #1679 from Runfusion/fix/full-suite-schema-and-cancel-error
fix: repair two post-merge Full Suite failures
This commit is contained in:
5
.changeset/fix-full-suite-schema-and-cancel-error.md
Normal file
5
.changeset/fix-full-suite-schema-and-cancel-error.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@runfusion/fusion": patch
|
||||
---
|
||||
|
||||
Fix two post-merge Full Suite test failures. Sync the roadmap store's schema-version assertion to core's `SCHEMA_VERSION` (116 → 117). Stop `useCeSessions` background refreshes (poll fallback and push events) from clearing an error a `cancel`/`remove` just surfaced — an in-flight session kept the poll running, which silently erased the action error before the user could see it.
|
||||
@@ -77,19 +77,27 @@ export function useCeSessions(options: UseCeSessionsOptions = {}): UseCeSessions
|
||||
};
|
||||
}, []);
|
||||
|
||||
const refresh = useCallback(async () => {
|
||||
try {
|
||||
const next = await transport.list(projectId);
|
||||
if (mounted.current) {
|
||||
setSessions(next);
|
||||
setError(undefined);
|
||||
// clearErrorOnSuccess: a user-initiated refresh (or the initial fetch) clears
|
||||
// any prior error on success. Background refreshes (poll fallback, push
|
||||
// events) pass false so a successful list fetch doesn't silently erase an
|
||||
// error a cancel/remove just surfaced — an in-flight session keeps the poll
|
||||
// running, which would otherwise wipe the action error before the user sees it.
|
||||
const refresh = useCallback(
|
||||
async (clearErrorOnSuccess = true) => {
|
||||
try {
|
||||
const next = await transport.list(projectId);
|
||||
if (mounted.current) {
|
||||
setSessions(next);
|
||||
if (clearErrorOnSuccess) setError(undefined);
|
||||
}
|
||||
} catch (err) {
|
||||
if (mounted.current) setError(err instanceof Error ? err.message : String(err));
|
||||
} finally {
|
||||
if (mounted.current) setLoading(false);
|
||||
}
|
||||
} catch (err) {
|
||||
if (mounted.current) setError(err instanceof Error ? err.message : String(err));
|
||||
} finally {
|
||||
if (mounted.current) setLoading(false);
|
||||
}
|
||||
}, [transport, projectId]);
|
||||
},
|
||||
[transport, projectId],
|
||||
);
|
||||
|
||||
// Initial fetch (and on project switch).
|
||||
useEffect(() => {
|
||||
@@ -102,7 +110,7 @@ export function useCeSessions(options: UseCeSessionsOptions = {}): UseCeSessions
|
||||
useEffect(() => {
|
||||
if (!enabled || !subscribe) return;
|
||||
return subscribe(() => {
|
||||
void refresh();
|
||||
void refresh(false);
|
||||
});
|
||||
}, [enabled, subscribe, refresh]);
|
||||
|
||||
@@ -111,7 +119,7 @@ export function useCeSessions(options: UseCeSessionsOptions = {}): UseCeSessions
|
||||
useEffect(() => {
|
||||
if (!enabled || !anyInFlight) return;
|
||||
const timer = setInterval(() => {
|
||||
void refresh();
|
||||
void refresh(false);
|
||||
}, pollIntervalMs);
|
||||
return () => clearInterval(timer);
|
||||
}, [enabled, anyInFlight, pollIntervalMs, refresh]);
|
||||
|
||||
@@ -743,10 +743,10 @@ describe("RoadmapStore", () => {
|
||||
});
|
||||
|
||||
describe("schema version", () => {
|
||||
it("schema version is 116 after init", () => {
|
||||
it("schema version is 117 after init", () => {
|
||||
// Tracks @fusion/core's SCHEMA_VERSION (the roadmap store layers on core's
|
||||
// Database). Bump this in lockstep when core adds a migration.
|
||||
expect(db.getSchemaVersion()).toBe(116);
|
||||
expect(db.getSchemaVersion()).toBe(117);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user