-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unhandled Runtime Error Error: ERR_ALREADY_CALLED #19
Comments
I wasn't able to reproduce the problem using the nextjs-template, nor the repository you provided. It just opens as usual for me :( Check if you are using the latest pnpm version, try removing node_modules and installing again UPD: Ok, I have it now. We can see the issue when using the latest version of sdk-react. Looking into it |
Fixed by changing core/init.ts to
In my project's i don't use eruda, but you can include eruda, i don't think it will break anythink! |
In my current project, i have only dark mode possible, so i don't know if it's my init.ts code that breaks or somethink else. for me, what i provided works with [email protected]. |
The problem is probably related to the React's StrictMode performing all effects twice. It is probably resetting refs also, we use them in the To solve it, we need to call the I currently have no time for it and can fix the problem only on the next week. Feel free to propose a solution |
Has anybody got around this issue? |
I can confirm that this is the fix: #19 (comment) |
Based on I managed to get it working #19 (comment) The diff is that I placed additionally I have added TL;DRexport function init(debug: boolean): void {
// Set @telegram-apps/sdk-react debug mode.
$debug.set(debug);
// Initialize special event handlers for Telegram Desktop, Android, iOS, etc.
// Also, configure the package.
initSDK();
// Mount all components used in the project.
if (backButton.isSupported()) {
backButton.mount();
}
// Define components-related CSS variables.
if (!miniApp.isMounted()) {
miniApp.mount();
miniApp.bindCssVars();
}
if (!themeParams.isMounted()) {
themeParams.mount();
}
themeParams.bindCssVars();
initData.restore();
if (!viewport.isMounted() && !viewport.isMounting()) {
void viewport.mount().catch((e) => {
console.error("Something went wrong mounting the viewport", e);
});
}
if (viewport.isMounted()) {
viewport.bindCssVars();
}
} |
i believe you can make PR with that code. at least this works for me. importing styles helped a lot. or we should just wait for react-ui, react-sdk to get fixed! |
Failed to launch application using latest version of template
Steps to Reproduce
pnpm run dev
ngrok http 3000
When trying to open bot in telegram getting problem
Tested for application created with same template a few month ago, all working good
The text was updated successfully, but these errors were encountered: