ocombe / ocLazyLoad

Lazy load modules & components in AngularJS
https://oclazyload.readme.io
MIT License
2.63k stars 510 forks source link

cache:false and double loading #395

Open MohamedAmineOuali opened 7 years ago

MohamedAmineOuali commented 7 years ago

Hello, First I wont to thank you for your efforts , it helps me a lot

I have read two issue about my problem but I can't find an answers for my question. I have a file that I should load without saving it to cache because it needs to run on every loading. When I use "cache:false" it all go fine but I have two identical file that are load to the browser. the problem is that I have same action that should not run twice when clique on the button so what should I do.

note: when removing cache:false the action work fine (only once). But I have problem loading the file when using the getback button and sometimes when making a refresh.

Thank you very much.

dgreene1 commented 7 years ago

I'm not a maintainer, but I'd be interested to look into your issue. Can you reproduce it via a jsFiddle?

If so, share it here, and we can check it out.

P.S. Did you see that a fix from way back was supposed to fix the cache busting and double run issue? https://github.com/ocombe/ocLazyLoad/commit/5a5d7f108578fe31c5ca1f7c8dfc2d3bccfd1106#diff-2eaedb8461ca33b78dcbfa62ccba7946R75

jeevasusej commented 7 years ago

You can append query string before the url. so that based on the query string, the browser will check whether need to load or not. Cache should be true for this case

{
                  insertBefore: '#loadJsBefore',
                  name: 'fancyTreeJs',
                  files: [{ type: 'js', path: 'bundles/fancytree?v=' + version }]
              }