Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
db6fd1b8e3 |
No files matched your search
@@ -18,7 +18,6 @@ import * as api from "./api";
|
||||
import { saveConnectionPreferences } from "./connection-preferences";
|
||||
import { resetConnectionReconcile } from "./connection-reconcile";
|
||||
import { queryClient, resetClient } from "./query-client";
|
||||
import { commitSedimentation } from "./sedimentation-state";
|
||||
|
||||
const {
|
||||
summary,
|
||||
@@ -701,28 +700,6 @@ it("shows a paused switch immediately even when task rows still say running", as
|
||||
expect(screen.queryByText("新的对话正在整理")).toBeNull();
|
||||
});
|
||||
|
||||
it("updates an already mounted home as soon as settings commits the switch receipt", async () => {
|
||||
render(
|
||||
<ApplicationsHome
|
||||
imports={imports}
|
||||
onManage={() => {}}
|
||||
onMemories={() => {}}
|
||||
onSettings={() => {}}
|
||||
/>,
|
||||
);
|
||||
expect(await screen.findAllByText("整理中")).toHaveLength(2);
|
||||
|
||||
act(() => {
|
||||
commitSedimentation({
|
||||
enabled: false,
|
||||
pending_retained: true,
|
||||
imports_unaffected: true,
|
||||
});
|
||||
});
|
||||
|
||||
await waitFor(() => expect(screen.getAllByText("已暂停")).toHaveLength(2));
|
||||
});
|
||||
|
||||
it("keeps the import-in-progress empty state stable without a progress link", async () => {
|
||||
summary.mockResolvedValue({
|
||||
memory_count: 0,
|
||||
|
||||
@@ -39,23 +39,3 @@ it("keeps a newer switch receipt when an older read lands later", async () => {
|
||||
expect(await olderRead).toEqual(paused);
|
||||
expect(queryClient.getQueryData(["sedimentation"])).toEqual(paused);
|
||||
});
|
||||
|
||||
it("keeps the newest read when concurrent reads finish out of order", async () => {
|
||||
let finishFirst: ((value: typeof enabled) => void) | undefined;
|
||||
getSedimentation
|
||||
.mockImplementationOnce(
|
||||
() =>
|
||||
new Promise<typeof enabled>((resolve) => {
|
||||
finishFirst = resolve;
|
||||
}),
|
||||
)
|
||||
.mockResolvedValueOnce(paused);
|
||||
|
||||
const first = refreshSedimentation();
|
||||
const second = refreshSedimentation();
|
||||
expect(await second).toEqual(paused);
|
||||
|
||||
finishFirst?.(enabled);
|
||||
expect(await first).toEqual(paused);
|
||||
expect(queryClient.getQueryData(["sedimentation"])).toEqual(paused);
|
||||
});
|
||||
@@ -11,12 +11,8 @@ queryClient.setQueryDefaults(SEDIMENTATION_KEY, {
|
||||
});
|
||||
|
||||
let revision = 0;
|
||||
let readsStarted = 0;
|
||||
let readsLanded = 0;
|
||||
onClientReset(() => {
|
||||
revision = 0;
|
||||
readsStarted = 0;
|
||||
readsLanded = 0;
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -24,14 +20,11 @@ onClientReset(() => {
|
||||
* newer PUT receipt committed by the settings page.
|
||||
*/
|
||||
export async function refreshSedimentation(): Promise<SedimentationState> {
|
||||
const order = ++readsStarted;
|
||||
const startedAtRevision = revision;
|
||||
const next = await getSedimentation();
|
||||
const current =
|
||||
queryClient.getQueryData<SedimentationState>(SEDIMENTATION_KEY);
|
||||
if (startedAtRevision !== revision && current) return current;
|
||||
if (order < readsLanded && current) return current;
|
||||
readsLanded = order;
|
||||
queryClient.setQueryData(SEDIMENTATION_KEY, next);
|
||||
return next;
|
||||
}
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
"name": "one-memory",
|
||||
"version": "1.0.4",
|
||||
"release": {
|
||||
"build_number": 12,
|
||||
"build_number": 13,
|
||||
"macos_min_version": "13.0",
|
||||
"app_update": "manual",
|
||||
"runtime_manifest_schema": 1,
|
||||
|
||||
Reference in new issue
Block a user