Git Product home page Git Product logo

Comments (16)

haroldao avatar haroldao commented on May 22, 2024 1

No I didn't. You're good to go.๐Ÿ™Œ๐Ÿฝ

from liquid-ajax-cart.

EvgeniyMukhamedjanov avatar EvgeniyMukhamedjanov commented on May 22, 2024 1

@haroldao
Aha. So it means that your PJAX root element is not body but under it.
What if you subscribe to the page change event (i think it is possible) and remove the js-cart-open class on every page change. I think it should be the only problem. All the other LAC classes depend on the cart state and shouldn't be changed after page change.

from liquid-ajax-cart.

haroldao avatar haroldao commented on May 22, 2024

I use "Operator" https://github.com/estrattonbailey/operator with Shopify Theme Lab https://github.com/uicrooks/shopify-theme-lab

from liquid-ajax-cart.

haroldao avatar haroldao commented on May 22, 2024

I don't use Slater but you can see Operator here (https://github.com/the-couch/slater/blob/master/packages/theme/src/scripts/router.js)

from liquid-ajax-cart.

haroldao avatar haroldao commented on May 22, 2024

image
Here's what I've got in my console

from liquid-ajax-cart.

EvgeniyMukhamedjanov avatar EvgeniyMukhamedjanov commented on May 22, 2024

Hey @haroldao . Can you guide me how I can replicate this issue on my local computer?
So as I understand I need to install the "shopify-theme-lab" theme, then install the "operator". Then I need to see the code how you use the operator and Liquid Ajax Cart.
Btw does this issue disappear if you remove the "operator" ?

from liquid-ajax-cart.

haroldao avatar haroldao commented on May 22, 2024

๐Ÿ˜ฎ๐Ÿ˜ฎ๐Ÿ˜ฎ... yes I still have the error message @EvgeniyMukhamedjanov when I remove operator
Here's the file where I imported L.A.C

image

from liquid-ajax-cart.

haroldao avatar haroldao commented on May 22, 2024

image

from liquid-ajax-cart.

EvgeniyMukhamedjanov avatar EvgeniyMukhamedjanov commented on May 22, 2024

@haroldao
Yeah, for sure it is not related to the Operator or any other package. It should be a problem with Webpack/Module system. I'll install the shopify-theme-lab tomorrow and try to import LAC. For now you can include LAC as you did it on the previous project โ€” using <script type="module">. After I find out what is the issue -- I let you know and you install LAC using npm again.
Can you also tell me if you did any changes in the "package.json" or any config files and if they are different from the current shopify-theme-lab repository?

from liquid-ajax-cart.

haroldao avatar haroldao commented on May 22, 2024

Side note : It's almost working (with your "manual" solution).... but when we change the page it's not working anymore since we have to "reload" the JS each time a page transition happens

from liquid-ajax-cart.

EvgeniyMukhamedjanov avatar EvgeniyMukhamedjanov commented on May 22, 2024

Hey @haroldao , I guess I found what was the issue. Can you please try if the updated version works for you:
https://github.com/EvgeniyMukhamedjanov/liquid-ajax-cart/blob/dev/docs/releases/liquid-ajax-cart-v1.10.1.js

Just download the file and put it next to the main.js and include it like this:

import './liquid-ajax-cart-v1.10.1.js';

and check if it works for you.

Please pay attention that Liquid Ajax Cart applies CSS classes to the body tag. It means if your PJAX root element is the body tag then after page change the classes will be missed. If it is the case then I can add an option to LAC to apply classes to the html tag.

Once all is good I'll upload the v1.10.1 to npm as well.

from liquid-ajax-cart.

haroldao avatar haroldao commented on May 22, 2024

yeah it's working well โœ….

Okay that's fine. I'll get rid of PJAX for this project then.

from liquid-ajax-cart.

EvgeniyMukhamedjanov avatar EvgeniyMukhamedjanov commented on May 22, 2024

@haroldao
Why do you want to get rid of PJAX? LAC should work well with PJAX because LAC listens only document events thus you can change DOM as you want.
Does LAC work after PJAX page change?

from liquid-ajax-cart.

haroldao avatar haroldao commented on May 22, 2024

no it's not working well.

here's a quick example : When I click a button (to open the cart drawer) and I change the page, the class js-cart-open is still set on the body

from liquid-ajax-cart.

EvgeniyMukhamedjanov avatar EvgeniyMukhamedjanov commented on May 22, 2024

Hey @haroldao
I've just updated the npm version, so you can remove the local file and install it from npm.
Let me know if it works for you and I'll close the issue then :-)

from liquid-ajax-cart.

haroldao avatar haroldao commented on May 22, 2024

thank you manโœจ๐Ÿ™Œ๐Ÿฝ

from liquid-ajax-cart.

Related Issues (19)

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.