qwik icon indicating copy to clipboard operation
qwik copied to clipboard

DocumentHead - title is not working

Open srinivas-dev-reddy opened this issue 2 years ago • 1 comments

Qwik Version

0.9.0

Operating System (or Browser)

Chrome

Node Version (if applicable)

16.16.0

Which component is affected?

Qwik City

Expected Behaviour

When using DocumentHead and setting title page title should be updated to the title string

Actual Behaviour

When using DocumentHead and setting title page is not working.

Additional Information

` import { component$, useClientEffect$, useStore, } from "@builder.io/qwik"; import type { DocumentHead } from "@builder.io/qwik-city";

export default component$(() => { const store = useStore({ count: 1, start: false, });

useClientEffect$(({ track, cleanup }) => { track(store, "start"); console.log("Starting clock"); if (!store.start) return; const timer = setInterval(() => { store.count++; }, 400);

cleanup(() => {
  clearInterval(timer);
});

});

return (

Count : {store.count}

<button onClick$={() => { store.start = true; }} > Start
); });

export const head: DocumentHead = { title: "Welcome to Qwik", }; `

above is the code i'm using

Screenshot 2022-09-22 at 8 43 07 AM

srinivas-dev-reddy avatar Sep 22 '22 03:09 srinivas-dev-reddy

Can you please provide a repo case? stackblitz.com link can work!

manucorporat avatar Oct 12 '22 08:10 manucorporat

Sorry I'm un able to reproduce this error. It may be that DocumentHead is only being used on a component, and not a qwik-city page. Closing for now, please reopen if you're still facing issues.

adamdbradley avatar Oct 31 '22 19:10 adamdbradley

I did run into this as well. For anyone looking at this in the future: Make sure your RouterHead component uses f.ex. head.title from the useDocumentHead hook.

d-kls avatar Mar 12 '23 10:03 d-kls