@@ -46,11 +46,17 @@ export class PostReactionComponent {
4646 }
4747
4848 private setupSubmitHandler ( ) {
49+ const buttons = this . reactionListContainer . querySelectorAll ( 'button' ) ;
50+
51+ function toggleButtons ( disabled : boolean ) {
52+ buttons . forEach ( b => b . disabled = disabled ) ;
53+ }
54+
4955 const handler = async ( event : Event ) => {
5056 event . preventDefault ( ) ;
5157
5258 const button = event . target as HTMLButtonElement ;
53- button . disabled = true ;
59+ toggleButtons ( true ) ;
5460 const id = button . value as ReactionID ;
5561 const issueExists = ! ! this . issue ;
5662
@@ -74,19 +80,17 @@ export class PostReactionComponent {
7480 this . reactions [ id ] += delta ;
7581 this . reactions . total_count += delta ;
7682 this . issue ! . reactions = this . reactions ;
77- button . disabled = false ;
83+ toggleButtons ( false ) ;
7884 this . setIssue ( this . issue ) ;
7985 }
8086
81- const buttons = this . element . querySelectorAll ( 'button[post-reaction]' ) ;
82- buttons . forEach ( button => button . addEventListener ( 'click' , handler , true ) )
87+ buttons . forEach ( b => b . addEventListener ( 'click' , handler , true ) )
8388 }
8489
8590 private getSubmitButtons ( ) : string {
8691 function buttonFor ( url : string , reaction : ReactionID , disabled : boolean , count : number ) : string {
8792 return `
8893 <button
89- post-reaction
9094 type="submit"
9195 action="javascript:"
9296 formaction="${ url } "
0 commit comments