Skip to content

[Bug?]: two pages render simultaneously#2297

Description

@huseeiin

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 馃槸

No response

Expected behavior 馃

No response

Steps to reproduce 馃暪

import { createAsync, query, Route, Router } from "@solidjs/router";
import { For, Suspense } from "solid-js";
const getVideos$ = query(async () => {
  "use server";
  await new Promise((r) => setTimeout(r, 1000));

  return [{ title: "hi", thumb: "https://picsum.photos/200/300" }];
}, "videos");

const getVideo$ = query(async () => {
  "use server";
  await new Promise((r) => setTimeout(r, 1000));
  return { title: "hi", thumb: "https://picsum.photos/200/300" };
}, "video");

export default function Home() {
  return (
    <Router>
      <Route
        path="/"
        component={() => {
          const videos = createAsync(() => getVideos$());

          return (
            <Suspense fallback={<p>Loading...</p>}>
              <For each={videos()}>
                {(video) => (
                  <a href="/video">
                    <h1>{video.title}</h1>
                    <img src={video.thumb} />
                  </a>
                )}
              </For>
            </Suspense>
          );
        }}
      />
      <Route
        path="/video"
        component={() => {
          const video = createAsync(() => getVideo$());
          return (
            <Suspense fallback={<p>Loading...</p>}>
              {video()?.title}
              <img src={video()?.thumb} />
            </Suspense>
          );
        }}
      />
    </Router>
  );
}

do exactly what's in the video:

Screencast_20260818_185051.webm

Context 馃敠

No response

Your environment 馃寧

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions