From 3fbeaf0e9e367f8969d9cb2a68e6c1af06f049c1 Mon Sep 17 00:00:00 2001 From: Kaity A Date: Sun, 12 Feb 2023 01:51:26 +0000 Subject: [PATCH] serialize outgoing searches returning out of order --- packages/client/src/components/MkInstanceSelectDialog.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/client/src/components/MkInstanceSelectDialog.vue b/packages/client/src/components/MkInstanceSelectDialog.vue index b2349c47e1..0d0123f0fb 100644 --- a/packages/client/src/components/MkInstanceSelectDialog.vue +++ b/packages/client/src/components/MkInstanceSelectDialog.vue @@ -50,11 +50,14 @@ let instances: Instance[] = $ref([]); let selected: Instance | null = $ref(null); let dialogEl = $ref>(); +let searchOrderLatch = 0; const search = () => { if (hostname === '') { instances = []; return; } + + const searchId = ++searchOrderLatch; os.api('federation/instances', { host: hostname, limit: 10, @@ -62,6 +65,7 @@ const search = () => { suspended: false, sort: '+pubSub', }).then(_instances => { + if (searchId !== searchOrderLatch) return; instances = _instances.map(x => ({ id: x.id, host: x.host,