Telegram-Mini-Apps / telegram-apps

Made from scratch TypeScript packages, examples and documentation you will surely need to start developing on Telegram Mini Apps.
https://docs.telegram-mini-apps.com/
MIT License
400 stars 79 forks source link

[Bug]: Solid.js router integration outdated #290

Closed XantreDev closed 2 months ago

XantreDev commented 2 months ago

Telegram Application

Telegram Desktop

Describe the Bug

Uncaught SyntaxError: The requested module '/node_modules/@solidjs/router/dist/index.jsx' does not provide an export named 'createIntegration'

To Reproduce


import { render } from "solid-js/web";

import { Application } from "./application";
import { Route, Router } from "@solidjs/router";
import { HashNavigator } from "@tma.js/sdk";
import { createIntegration } from "@tma.js/solid-router-integration";

render(
  () => {
    const navigator = new HashNavigator([{}], 0);
    void navigator.attach();

    return (
        {/* @ts-expect-error */}
        <Router source={createIntegration(() => navigator)}>
          <Route component={Application} path={"*"} />
        </Router>
    );
  },
  document.getElementById("root") as HTMLElement,
);

### Expected Behavior

It must work
XantreDev commented 2 months ago

createIntegration deleted since https://github.com/solidjs/solid-router/commit/d288c8fde67cb365b8f12062944bef3419442d83#diff-616b1f25a229de030f09926b82dafdc6aa0c93a00bd851f2b1f41796570fd629

We need to use createRouter api

XantreDev commented 2 months ago

I downgraded to 0.9.1 version of solidjs/router

heyqbnk commented 2 months ago

To be fixed in @tma.js/sdk@3.0: https://github.com/Telegram-Mini-Apps/tma.js/blob/feature/sdk-3-0/packages/solid-router-integration/src/createRouter.ts

Will be released in the next few days

XantreDev commented 2 months ago

@heyqbnk I like an implementation of BrowserNavigation in sdk v3, Looks clean. Basically it's stack based navigator like we have in native apps

When will it be released?

XantreDev commented 2 months ago

I've also encountered that current router can duplicate stack item on first navigation on the same path image

heyqbnk commented 2 months ago

Hey. Issue should be fixed now, consider updating to the latest packages versions.

I wasn't able to reproduce the problem you've met. In case, you still have it, let me know in a separate issue.

Here is the template you could use to learn more about how integration works now: https://github.com/Telegram-Mini-Apps/solidjs-template

XantreDev commented 2 months ago

Thank, I will try it