Skip to content

css on transition/statechange only? #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sinandomeng opened this issue Jul 17, 2017 · 8 comments
Closed

css on transition/statechange only? #2

sinandomeng opened this issue Jul 17, 2017 · 8 comments
Assignees
Labels

Comments

@sinandomeng
Copy link

Hi, first thanks for this great script.

So, at first I ended up on an error and my console.log logs that I need to install bestol load stylesheet before I can use your script.
After I installed, css are now loaded in each specific state. But there is one thing I observed. When I am on the homepage css for that state doesn't load as windows load, it only happens on transition/state change??

Help

@AlexandreDenis
Copy link

+1 I have a similar issue.
At page loading, the CSS files are not loaded for my current state. But they are after transition, if I come back to the home page.
Is it a bug or a bad use of your library?

@harm-less
Copy link
Owner

That's odd, but I do think you're right because when I use my demo directly, I see only 1 stylesheet loaded while on the other hand, I see 3 when I go to the demo state from a different state.

Therefore this is a bug. Thanks for reporting it.

@harm-less harm-less added the bug label Dec 11, 2017
@harm-less harm-less self-assigned this Dec 11, 2017
@harm-less
Copy link
Owner

Actually, the demo was working fine as it loaded all three stylesheet but it just didn't display them in the view. It only does this after a transition, but that's not the same problem you guys are having.

Can either of you supply a small demo in https://plnkr.co/ or https://jsfiddle.net/?

@AlexandreDenis
Copy link

AlexandreDenis commented Dec 11, 2017

Here is a small demo which reproduces the bug: Plunker.

As you will see, the expected behavior is that when the user clicks on "State #1", a blue text appears, and if it clicks on "State #2", a red one appears. But the first "state" you select won't have any CSS applied to it template. Indeed, the text stays black. The style is applied only when the user clicks on the other state and from this moment, all styles are well taken into account.

@harm-less
Copy link
Owner

I see... I'll look into the issue, thanks for taking the time to make the plunker 👍

@harm-less
Copy link
Owner

It seems it's a bit worse than I suspected. My script is doing everything as expected, but the browser isn't really handling the disabled state of the stylesheet very well. Removing the code that disables/enables the stylesheet, and everything seems to work just fine. But that defeats the purpose of the plugin quite a bit... So I'll have to dive into this issue a bit more.

@harm-less
Copy link
Owner

I think I got it: https://plnkr.co/edit/NaqHA4Ti9OZ883XVmLOC?p=preview (I updated the plugin's source file that includes the fix I just did). I'll be making a patch shortly.

@harm-less
Copy link
Owner

harm-less commented Dec 11, 2017

I've made the patch (0.1.1). So hopefully this fixes your problem, let me know your findings!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants