Open hethon opened 4 months ago
Instead of calling Telegram.WebApp.switchInlineQuery
, directly calling Telegram.WebView.postEvent
with eventType
'web_app_switch_inline_query'
seems to have solved the issue. I still don't know why the issue appeared in the first place tho.
I have a share button in my miniapp that when clicked switches to inline query interface using Telegram.WebApp.switchInlineQuery. It was all good and working fine until I decided to modularize my code with ES6Modules. It suddenly stopped working and there was no error messages or anything that would help me know the issue. Every other functionalities from Telegram.WebApp were working, it was only switchInlineQuery which wasn't working.
With some tiresome trials I narrowed down the error to a level that is easy to comprehend. The conclusion I came up with is that switchInlineQuery doesn't work if it's inside a module. In other words if you have a script called index.js and you have used switchInlineQuery inside it and you included it in your index.html as of type=module it won't work. But if you include it as a normal script it works.
You can find a minimum working example that can reproduce this issue 👇
index.html
index.js