qwik icon indicating copy to clipboard operation
qwik copied to clipboard

<Link/> inside of <Resource/>: QWIK ERROR can't access property "href", thing is undefined

Open boohba opened this issue 2 years ago • 3 comments

Qwik Version

0.13.3

Operating System (or Browser)

Mozilla Firefox Developer Edition for Arch Linux 107.0b9 (64bit)

Node Version (if applicable)

19.0.1

Which component is affected?

Qwik Runtime

Expected Behaviour

I expect Link to work.

Actual Behaviour

It doesn't work. Here is the error: https://pastebin.com/4z2g3uXF

Additional Information

interface Stuff {
  href: string
}

export default component$(() => {
  const endpoint = useEndpoint<Stuff>()

  return <Resource value={endpoint} onResolved={(thing) => <Link href={thing.href}>Click me</Link>}/>
});

export const onGet: RequestHandler<Stuff> = () => {
  return { href: "/hello-world" }
}

It works fine if the data passed through useEndpoint is a primitive (like string or number), if it is an object - everything explodes.

Reproducer: https://github.com/boohba/qwik-weird-resource-bug-reproducer

boohba avatar Nov 13 '22 01:11 boohba

does it work if you add an onPending handler that returns an empty tag?

ramsaylanier avatar Nov 13 '22 20:11 ramsaylanier

does it work if you add an onPending handler that returns an empty tag?

Nope.

ghost avatar Nov 14 '22 01:11 ghost

Looks related #1927

skuridin avatar Nov 15 '22 15:11 skuridin

I'm running into this issue as well. Here is a reliable reproduction: https://stackblitz.com/edit/qwik-starter-cw9juq?file=src/routes/something/index.tsx

Steps:

  • In the browser window to the right, click "Go to demo page" button
  • Click "Go to homepage (triggers the bug)" button

RaeesBhatti avatar Jan 27 '23 05:01 RaeesBhatti