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 @@ ...@@ -24,6 +24,7 @@
.button { .button {
padding: 7px 18px; padding: 7px 18px;
border-radius: 4px; border-radius: 4px;
user-select: none;
&:active, &:active,
&:focus { &:focus {
outline: none; outline: none;
......
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
* limitations under the License. * limitations under the License.
*/ */
import { from, timer, combineLatest, firstValueFrom } from 'rxjs'; import { of, from, timer, combineLatest, firstValueFrom } from 'rxjs';
import { take } from 'rxjs/operators'; import { take, catchError } from 'rxjs/operators';
const noEarlierThan = async <P extends Promise<any>>( const noEarlierThan = async <P extends Promise<any>>(
promise: P, promise: P,
...@@ -23,11 +23,15 @@ const noEarlierThan = async <P extends Promise<any>>( ...@@ -23,11 +23,15 @@ const noEarlierThan = async <P extends Promise<any>>(
) => { ) => {
const source$ = combineLatest([ const source$ = combineLatest([
timer(minimumTime).pipe(take(1)), timer(minimumTime).pipe(take(1)),
from(promise) from(promise).pipe(catchError((error) => of(error)))
]); ]);
const [, result] = await firstValueFrom(source$); const [, result] = await firstValueFrom(source$);
if (result instanceof Error) {
throw result;
} else {
return result; return result;
}
}; };
export default noEarlierThan; 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