Skip to content

Metaboxes: Hold jQuery ready only if there are metaboxes - #3476

Merged
youknowriad merged 1 commit into
masterfrom
fix/jquery-init-issue
Nov 14, 2017
Merged

youknowriad merged 1 commit into
masterfrom
fix/jquery-init-issue

Conversation

@youknowriad

Copy link
Copy Markdown
Contributor

closes #3465

We hold jQuery ready event when we have metaboxes still being loaded but this breaks the heartbeat script since we never trigger the "ready" event if we do not have metaboxes.

This PR fixes the issue by holding the "ready" event only if we have metaboxes.

@youknowriad youknowriad added the [Type] Bug An existing feature does not function as intended label Nov 14, 2017
@youknowriad youknowriad self-assigned this Nov 14, 2017
@codecov

codecov Bot commented Nov 14, 2017 •

Copy link
Copy Markdown

Codecov Report

Merging #3476 into master will decrease coverage by 0.04%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #3476      +/-   ##
=========================================
- Coverage   34.24%   34.2%   -0.05%     
=========================================
  Files         257     257              
  Lines        6739    6744       +5     
  Branches     1222    1223       +1     
=========================================
- Hits         2308    2307       -1     
- Misses       3740    3745       +5     
- Partials      691     692       +1
Impacted Files Coverage Δ
editor/effects.js 45.88% <0%> (-1.74%) ⬇️
editor/table-of-contents/index.js 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a1ff0f3...812d62d. Read the comment docs.

@aduth aduth left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finding this to be another case where refx would be better suited to fire effects after the original action occurs. As implemented here, it means we could create a selector to reuse between META_BOX_LOADED and INITIALIZE_META_BOX_STATE to find getUnloadedMetaBoxes to determine if there is anything pending load.

I still don't really understand the purpose of holdReady, but if we're assuming it should be holding so long as there are unloaded meta boxes, then I agree with the change that it should only hold in the first place if there are meta boxes.

Comment thread editor/effects.js Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to account for action.metaBoxes.advanced ? I guess we're not showing these?

Otherwise this could work well:

if ( some( action.metaBoxes ) ) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found that "advanced" and "normal" are the showing the same metaboxes somehow. We're still not showing the metaboxes supposed to appear under the title but I'm not sure how these are registered.

@youknowriad
youknowriad force-pushed the fix/jquery-init-issue branch from 95aa65a to 812d62d Compare November 14, 2017 13:49
@youknowriad
youknowriad merged commit a85c49e into master Nov 14, 2017
@youknowriad
youknowriad deleted the fix/jquery-init-issue branch November 14, 2017 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Intermittent failure "Cannot read property hasClass of undefined"

2 participants