Code Monkey home page Code Monkey logo

Comments (9)

Dindaleon avatar Dindaleon commented on May 18, 2024 1

This is happening to me with a fresh install when I add <QwikPartytown forward={['dataLayer.push', 'fbq']} /> to the root.tsx

export default component$(() => {
  /**
   * The root of a QwikCity site always start with the <QwikCityProvider> component,
   * immediately followed by the document's <head> and <body>.
   *
   * Don't remove the `<head>` and `<body>` elements.
   */

  return (
    <QwikCityProvider>
      <head>
        <meta charSet="utf-8" />
        <link rel="manifest" href="/manifest.json" />
        <QwikPartytown forward={['dataLayer.push', 'fbq']} /> <---- If I remove this line, the error goes away
        <RouterHead />
        
      </head>
      <body lang="en">
        <RouterOutlet />
        <ServiceWorkerRegister />
      </body>
    </QwikCityProvider>
  );
});

from qwik.

wmertens avatar wmertens commented on May 18, 2024

This sounds like some sort of import order issue maybe? Not sure how your additions cause this to break.

It's probably happening here, which uses useQwikCityEnv, which uses useServerData, which is injected into the render function by qwik-city here which generates it from the incoming requests here.

from qwik.

Nefcanto avatar Nefcanto commented on May 18, 2024

@wmertens, because we want to have dynamic settings, one thing we tried was to return a function that returns the render function in entry.ssr.tsx. In other words, converting this:

export default function (opts: RenderToStreamOptions) {
    return renderToStream(<Root />, {
        manifest,
        ...opts,
        // Use container attributes to set attributes on the html tag.
        containerAttributes: {
            lang: opts.serverData?.locale || "en",
            ...opts.containerAttributes,
        },
    });
}

to this:

export default function (props) {
    function render(opts: RenderToStreamOptions) {
        return renderToStream(<Root {...props} />, {
            manifest,
            ...opts,
            containerAttributes: {
                lang: opts.serverData?.locale || "en",
                ...opts.containerAttributes,
            },
        });
    }
    return render(props)
}

And changing this line in entry.express.ts, from this:

const { router, notFound } = createQwikCity({ render, qwikCityPlan, manifest });

to this:

const props = {} // reading settings dynamically in express layer, rather than Qwik layer when the app wants to start
const render = renderer(props)
const { router, notFound } = createQwikCity({ render, qwikCityPlan, manifest });

And that caused this error. But that's a totally valid JavaScript code. What could be wrong here?

from qwik.

wmertens avatar wmertens commented on May 18, 2024

Seems ok, you'll have to step through it to figure it the problem.

from qwik.

Nefcanto avatar Nefcanto commented on May 18, 2024

@wmertens, I have done it a couple of times. But I can't find out the problem. That's why I have submitted an issue. The error is very vague.

from qwik.

wmertens avatar wmertens commented on May 18, 2024

Myeah, better to do the dynamic environment like I explained in the other issue.

from qwik.

GrandSchtroumpf avatar GrandSchtroumpf commented on May 18, 2024

This happens to me when opening the console in the devtools of Firefox with this additional warning in the console:

Source map error: Error: NetworkError when attempting to fetch resource.
Resource URL: moz-extension://356a5cca-d12d-4591-83bc-b31caa7d6363/inject.js
Source Map URL: inject.js.map

from qwik.

RaeesBhatti avatar RaeesBhatti commented on May 18, 2024

I ran into this when using QwikPartytown integration as well. Here's a reproduction: https://stackblitz.com/edit/qwik-starter-7l7lf7?file=src%2Froot.tsx

The above link only runs into an error when you click the reload icon. You'll be able to see the error in terminal.
Screenshot 2024-03-23 at 7 16 05 PM

from qwik.

ahme-dev avatar ahme-dev commented on May 18, 2024

I faced the same issue, but it was only due to the hostname/domain (localhost) having data of previous app stored in it. It solved itself when I cleared cookies and site data

from qwik.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.