Skip to content

Support router integrations of solid-app-router #96

@arksun-bc

Description

@arksun-bc

example usage: src/entry-client.tsx

import { render } from "solid-js/web";
import { hashIntegration } from "solid-app-router";
import { StartClient } from "solid-start/entry-client";

render(() => <StartClient routerIntergration={hashIntegration}  />, document.body);

example change: packages/start/entry-client/StartClient.tsx

import { MetaProvider } from "solid-meta";
import { Router } from "solid-app-router";
import { StartProvider } from "../entry-server/StartContext";
import Root from "~/root";

const rootData = Object.values(import.meta.globEager("/src/root.data.(js|ts)"))[0];
const dataFn = rootData ? rootData.default : undefined;

// typeof routerIntergration = RouterIntegration | undefined
// TODO: validate routerIntergration

export default ({ routerIntergration }) => {
  return (
    <StartProvider>
      <MetaProvider>
        <Router source={routerIntergration && routerIntergration()} data={dataFn}>
          <Root />
        </Router>
      </MetaProvider>
    </StartProvider>
  );
};

I hardcoded hashIntegration from the above solution, the outcome looks good to me

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions