Skip to content

[🐞] CSS module not loading after press back button on browser #5338

Open
@anasalaqeel

Description

@anasalaqeel

Which component is affected?

Qwik City (routing)

Describe the bug

I'm trying to do a JS event when I'm clicking on a button I want to change some other element background.

The problem:

the problem is that I'm using the CSS module approach which is styles.module.css and everything is working fine until I do any JavaScript event (click event in our example below) before navigating to any other route. When I'm doing any JavaScript event and then press on another link to navigate to another page, then I decide to go back for some reason, here the problem occurs, which is when I press on back button in the browser, the styles of the page which I go back to it disappear and the whole styles.module.css not applying to the component.

Example here:

https://codesandbox.io/p/sandbox/gracious-meadow-g3df49?file=%2Fsrc%2Froutes%2Findex.tsx%3A9%2C1

How to use examples to get the problem

Step 1: Press on the change color button to make a JavaScript event.
Step 2: After you see the link color has been changed, press on the link to navigate outside the page e.g. 404 or whatever you see there.
Step 3: Press the back button on the browser and then you will see the link styles have disappeared and only the style which came from the styles.module.css.

Done!

Please Fix this issue ASAP

Thank you
Best regards

Reproduction

https://codesandbox.io/p/sandbox/gracious-meadow-g3df49?file=%2Fsrc%2Froutes%2Findex.tsx%3A9%2C1

Steps to reproduce

No response

System Info

System:
    OS: Windows 10 10.0.22621
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 5.51 GB / 15.88 GB
  Binaries:
    Node: 16.17.1 - C:\Program Files\nodejs\node.EXE
    npm: 8.19.2 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (118.0.2088.46)
    Internet Explorer: 11.0.22621.1
  npmPackages:
    @builder.io/qwik: ^1.2.13 => 1.2.13
    @builder.io/qwik-city: ^1.2.13 => 1.2.13
    @builder.io/qwik-react: 0.5.0 => 0.5.0
    undici: 5.22.1 => 5.22.1
    vite: 4.4.7 => 4.4.7

Additional Information

I'm trying to do a JS event when I'm clicking on a button I want to change some other element background.

The problem:

the problem is that I'm using the CSS module approach which is styles.module.css and everything is working fine until I do any JavaScript event (click event in our example below) before navigating to any other route. When I'm doing any JavaScript event and then press on another link to navigate to another page, then I decide to go back for some reason, here the problem occurs, which is when I press on back button in the browser, the styles of the page which I go back to it disappear and the whole styles.module.css not applying to the component.

Example here:

https://codesandbox.io/p/sandbox/gracious-meadow-g3df49?file=%2Fsrc%2Froutes%2Findex.tsx%3A9%2C1

How to use examples to get the problem

Step 1: Press on the change color button to make a javascript event.
Step 2: After you see the link color has been changed, press on the link to navigate outside the page e.g. 404 or whatever you see there.
Step 3: Press the back button on the browser and then you will see the link styles have disappeared and only the style which came from the styles.module.css.

Done!

Please Fix this issue ASAP

Thank you
Best regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions