Unverified Commit 2c7ecb25 authored by Andrey Azov's avatar Andrey Azov Committed by GitHub
Browse files

Disable text selection in buttons (#557)

Plus, prevent instant rejection of promises in the `noEarlierThan` helper
parent b8265e08
Pipeline #187124 passed with stages
in 5 minutes and 2 seconds
......@@ -24,6 +24,7 @@
.button {
padding: 7px 18px;
border-radius: 4px;
user-select: none;
&:active,
&:focus {
outline: none;
......
......@@ -14,8 +14,8 @@
* limitations under the License.
*/
import { from, timer, combineLatest, firstValueFrom } from 'rxjs';
import { take } from 'rxjs/operators';
import { of, from, timer, combineLatest, firstValueFrom } from 'rxjs';
import { take, catchError } from 'rxjs/operators';
const noEarlierThan = async <P extends Promise<any>>(
promise: P,
......@@ -23,11 +23,15 @@ const noEarlierThan = async <P extends Promise<any>>(
) => {
const source$ = combineLatest([
timer(minimumTime).pipe(take(1)),
from(promise)
from(promise).pipe(catchError((error) => of(error)))
]);
const [, result] = await firstValueFrom(source$);
return result;
if (result instanceof Error) {
throw result;
} else {
return result;
}
};
export default noEarlierThan;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment