From 0e1a0b31f81c3c7d4a404a532b8b7eebb7b51e85 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 b2349c47e..0d0123f0f 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,