serialize outgoing searches returning out of order
This commit is contained in:
parent
99accc4502
commit
0e1a0b31f8
1 changed files with 4 additions and 0 deletions
|
@ -50,11 +50,14 @@ let instances: Instance[] = $ref([]);
|
||||||
let selected: Instance | null = $ref(null);
|
let selected: Instance | null = $ref(null);
|
||||||
let dialogEl = $ref<InstanceType<typeof XModalWindow>>();
|
let dialogEl = $ref<InstanceType<typeof XModalWindow>>();
|
||||||
|
|
||||||
|
let searchOrderLatch = 0;
|
||||||
const search = () => {
|
const search = () => {
|
||||||
if (hostname === '') {
|
if (hostname === '') {
|
||||||
instances = [];
|
instances = [];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const searchId = ++searchOrderLatch;
|
||||||
os.api('federation/instances', {
|
os.api('federation/instances', {
|
||||||
host: hostname,
|
host: hostname,
|
||||||
limit: 10,
|
limit: 10,
|
||||||
|
@ -62,6 +65,7 @@ const search = () => {
|
||||||
suspended: false,
|
suspended: false,
|
||||||
sort: '+pubSub',
|
sort: '+pubSub',
|
||||||
}).then(_instances => {
|
}).then(_instances => {
|
||||||
|
if (searchId !== searchOrderLatch) return;
|
||||||
instances = _instances.map(x => ({
|
instances = _instances.map(x => ({
|
||||||
id: x.id,
|
id: x.id,
|
||||||
host: x.host,
|
host: x.host,
|
||||||
|
|
Loading…
Reference in a new issue