Skip to content
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

[BUG] Data Ajax - Plugin calls wb.init forever #9198

Open
EricDunsworth opened this issue Oct 22, 2021 · 2 comments · May be fixed by #9200
Open

[BUG] Data Ajax - Plugin calls wb.init forever #9198

EricDunsworth opened this issue Oct 22, 2021 · 2 comments · May be fixed by #9200

Comments

@EricDunsworth
Copy link
Member

EricDunsworth commented Oct 22, 2021

Required information

Describe the bug
I've noticed that Data Ajax endlessly calls wb.init - even after it's fulfilled its purpose (i.e. done AJAXing-in data). An if condition in wb.init prevents anything further from happening during the endless calls.

It looks like this behaviour was first introduced by #6076. That PR's stated purpose was to fix an infinite loop while loading - but in practice it seems to have had the opposite effect :S.

I tested the Data Ajax demo page in WET 4.0.5 (before) and 4.0.6's (after) production files with the following results:

  • 4.0.5 had six wb.init calls for wb-data-ajax-* (expected)
  • 4.0.6 had endless wb.init calls for wb-data-ajax-* and wb-prettify (prettify is setup on a parent element of some of the examples - so it was brought along for the ride)

To Reproduce (master branch)

  1. Add this line to the beginning of wb.init in src/core/wb.js:
console.log( "init " + componentName + "..." );
  1. Run grunt
  2. Visit your built version of the Data Ajax demo page in any browser
  3. Press F12 and navigate to your browser's console tab

Expected behaviour
A bunch of init messages appear during initial page load and cease after all the data has finished AJAXing-in.

Actual behaviour
Same as expected behaviour... but then the following init messages get spammed forever:

"init wb-menu..."
"init wb-data-ajax-replace..."

Who shall do the work?
Anyone. I'll send in a PR soon to try fixing it. But I'm not very experienced with plugin initialization...

Additional information

Version of WET-BOEW/GCWeb you are using
4.0.43.2 (development - i.e. master branch)

Desktop/Smartphone (please complete the following information)

  • OS or Device: Windows 10
  • Browsers: Firefox, Chromium (Edge), IE11

Additional context

  • Plugins that are are used in combination with Data Ajax (like the menu plugin that ties into the mega menu) are also affected. But that's just because they're waiting on Data Ajax to finish.
  • Almost every page in the WET repo is affected by this behaviour due to the mega menu.
EricDunsworth added a commit to EricDunsworth/wet-boew that referenced this issue Oct 22, 2021
@EricDunsworth EricDunsworth linked a pull request Oct 22, 2021 that will close this issue
@duboisp
Copy link
Member

duboisp commented Nov 7, 2021

@EricDunsworth please re-test. The recent patches to jQuery has impacted the data-ajax plugin.

Also, I noticed the wet-boew is looking periodically, via the timepoke, if there any new data-ajax plugin added on the page. May be the issue you are describing is related to that behaviour. May be instead of using timepoke it might worth to explore the experimental CSS animation solution here: https://github.com/wet-boew/wet-boew-experimental/blob/master/src/wet-boew.js#L49

@EricDunsworth
Copy link
Member Author

EricDunsworth commented Nov 19, 2021

Just retried the OP's reproduction steps in the master branch (v4.0.44.5). The actual outcome is still the same as when this issue was first posted :(.

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

Successfully merging a pull request may close this issue.

2 participants