question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Spinner remains on inline button after click

See original GitHub issue

Context

Expected Behavior

Spinner animation on the inline callback button should disappear after click was processed at the backend

Current Behavior

Spinner animation remains even after button click was handled at the backend image

Maybe I do something wrong, here is a piece of code:

  // on 'checkbox' option button click..
  bot.action(/o_\d+/, async (ctx) => {
      /*
        - extract index of the button
        - toggle checked state in the session
        - regenerate array of buttons to render check marks accordingly
        - update previous message 
      */
      return ctx.editMessageText('some title here',
      Extra.markup((m) =>
        m.inlineKeyboard( [/* array of updated buttons */], { columns:2 } )
      )
    );
});

Looks like Telegram doesn’t get correct response when I edit existing message instead of sending new reply and still waits for something after click. Maybe I should not return ctx.editMessageText but return something like 200 OK code?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8

github_iconTop GitHub Comments

12reactions
YuriGorcommented, May 21, 2019

According to telegram docs, answerCallbackQuery should be used I tried this:

bot.action(/o_\d+/, async (ctx) => {
      await ctx.editMessageText('some title here',
      Extra.markup((m) =>
        m.inlineKeyboard( [/* array of updated buttons */], { columns:2 } )
      ));
      ctx.answerCbQuery();
});
``
And now it works perfectly.
1reaction
YuriGorcommented, May 6, 2020

you can test rate here: https://t.me/BuyOrNotBot but it’s in Russian. To see checkbox button choose or say “/start” and then when he will say his Russian greeting abracadabra - send him some text then the questionnaire will start with checkbox buttons. But state update delay depends on the backend of coarse, in my case, it’s pretty fast

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to add a spinner icon to button when it's in the Loading ...
Here's a simple demo that shows the behavior I describe above. As you see when it enters the Loading state the icon just...
Read more >
Create a Button with a Loading Spinner in HTML & CSS
In today's post I'll be showing you how to use HTML and CSS to create an awesome looking button that features a loading...
Read more >
::-webkit-inner-spin-button - CSS: Cascading Style Sheets | MDN
The ::-webkit-inner-spin-button CSS pseudo-element is used to style the inner part of the spinner button of number picker input elements.
Read more >
Tailwind CSS Spinner / Loader - Free Examples & Tutorial
Responsive spinner/ loader build with Tailwind CSS. Spinners are used while loading content or performing another process that the user needs to wait...
Read more >
How to add a loading spinner to an Angular Material button
Click here for a 2 minute complete guide to adding a loading spinner to the Angular Material Button. Code and explanation included.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found