mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 16:53:34 +00:00
feat: improve async actions docs and guards (#4215)
* docs: clarify submit handler in standalone example * docs: clarify protection against re-running actions * docs: clarify that these directives replace click and ngSubmit * docs: clarify `void` * feat: disable action directive on bitsubmit disable * docs: fix grammar * docs: change to note * feat: guard against double running bitAction
This commit is contained in:
@@ -18,6 +18,8 @@ export class BitActionDirective implements OnDestroy {
|
||||
private destroy$ = new Subject<void>();
|
||||
private _loading$ = new BehaviorSubject<boolean>(false);
|
||||
|
||||
disabled = false;
|
||||
|
||||
@Input("bitAction") protected handler: FunctionReturningAwaitable;
|
||||
|
||||
readonly loading$ = this._loading$.asObservable();
|
||||
@@ -39,7 +41,7 @@ export class BitActionDirective implements OnDestroy {
|
||||
|
||||
@HostListener("click")
|
||||
protected async onClick() {
|
||||
if (!this.handler) {
|
||||
if (!this.handler || this.loading || this.disabled || this.buttonComponent.disabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user