Fix form <select> value not being up to date by the time we auto-submit the form on selection (#105)
Follow-up to https://github.com/matrix-org/matrix-public-archive/pull/102#discussion_r1002190782
This commit is contained in:
parent
d2d6c5a580
commit
7c09ac13f9
|
@ -183,8 +183,16 @@ class RoomDirectoryView extends TemplateView {
|
||||||
// modal close callback but this races with it and sometimes we beat it.
|
// modal close callback but this races with it and sometimes we beat it.
|
||||||
const path = vm.navigation.pathFrom([]);
|
const path = vm.navigation.pathFrom([]);
|
||||||
vm.navigation.applyPath(path);
|
vm.navigation.applyPath(path);
|
||||||
// Submit the page with the new homeserver selection to get results.
|
|
||||||
headerForm.submit();
|
// Set the `<select>` value before we submit to ensure we have the most up to
|
||||||
|
// date information. Normally this would be updated by having Hydrogen do its
|
||||||
|
// render cycle and have the `<option selected>` be swapped around.
|
||||||
|
homeserverSelectElement.value = homeserverSelection;
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
// Submit the page with the new homeserver selection to get results.
|
||||||
|
headerForm.submit();
|
||||||
|
}, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue