Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Remove 'is-loading' class requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
Aljullu committed Aug 3, 2020
1 parent 7d6adb2 commit 28b72d2
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 70 deletions.
3 changes: 0 additions & 3 deletions assets/js/base/utils/render-frontend.js
Expand Up @@ -41,9 +41,6 @@ const renderBlockFrontend = ( {

// Use Array.forEach for IE11 compatibility.
Array.prototype.forEach.call( containers, ( el, i ) => {
if ( ! el.classList.contains( 'is-loading' ) ) {
return;
}
for ( let j = 0; j < parentSelectorsToSkip.length; j++ ) {
if ( el.parentNode.closest( parentSelectorsToSkip[ j ] ) ) {
return;
Expand Down
41 changes: 6 additions & 35 deletions assets/js/blocks/products/all-products/index.js
Expand Up @@ -5,7 +5,6 @@ import { __ } from '@wordpress/i18n';
import { InnerBlocks } from '@wordpress/block-editor';
import { registerBlockType } from '@wordpress/blocks';
import { Icon, grid } from '@woocommerce/icons';
import classNames from 'classnames';
import '@woocommerce/atomic-blocks';

/**
Expand Down Expand Up @@ -64,9 +63,9 @@ const blockSettings = {
};
return (
<div
className={ classNames(
'is-loading',
getBlockClassName( 'wc-block-all-products', attributes )
className={ getBlockClassName(
'wc-block-all-products',
attributes
) }
{ ...data }
>
Expand All @@ -81,10 +80,10 @@ const blockSettings = {
*/
registerBlockType( 'woocommerce/all-products', {
...blockSettings,
/**
* Deprecation rule to handle the previous default rows which was 1 instead of 3.
*/
deprecated: [
/**
* Deprecation rule to handle the previous default rows which was 1 instead of 3.
*/
{
attributes: Object.assign( {}, blockSettings.attributes, {
rows: { type: 'number', default: 1 },
Expand All @@ -106,33 +105,5 @@ registerBlockType( 'woocommerce/all-products', {
);
},
},
/**
* Deprecation rule to handle the block without the 'is-loading' class.
*/
{
attributes: blockSettings.attributes,
save( { attributes } ) {
const dataAttributes = {};
Object.keys( attributes )
.sort()
.forEach( ( key ) => {
dataAttributes[ key ] = attributes[ key ];
} );
const data = {
'data-attributes': JSON.stringify( dataAttributes ),
};
return (
<div
className={ getBlockClassName(
'wc-block-all-products',
attributes
) }
{ ...data }
>
<InnerBlocks.Content />
</div>
);
},
},
],
} );
3 changes: 0 additions & 3 deletions assets/js/blocks/reviews/all-reviews/index.js
Expand Up @@ -12,7 +12,6 @@ import '../editor.scss';
import Editor from './edit';
import sharedAttributes from '../attributes';
import save from '../save.js';
import getDeprecatedProperty from '../deprecated.js';
import { example } from '../example';

const attributes = {
Expand Down Expand Up @@ -67,6 +66,4 @@ registerBlockType( 'woocommerce/all-reviews', {
* Save the props to post content.
*/
save,

deprecated: getDeprecatedProperty( attributes ),
} );
23 changes: 0 additions & 23 deletions assets/js/blocks/reviews/deprecated.js

This file was deleted.

3 changes: 0 additions & 3 deletions assets/js/blocks/reviews/reviews-by-category/index.js
Expand Up @@ -11,7 +11,6 @@ import { Icon, review } from '@woocommerce/icons';
import Editor from './edit';
import sharedAttributes from '../attributes';
import save from '../save.js';
import getDeprecatedProperty from '../deprecated.js';
import { example } from '../example';

const attributes = {
Expand Down Expand Up @@ -73,6 +72,4 @@ registerBlockType( 'woocommerce/reviews-by-category', {
* Save the props to post content.
*/
save,

deprecated: getDeprecatedProperty( attributes ),
} );
3 changes: 0 additions & 3 deletions assets/js/blocks/reviews/reviews-by-product/index.js
Expand Up @@ -11,7 +11,6 @@ import '../editor.scss';
import Editor from './edit';
import sharedAttributes from '../attributes';
import save from '../save.js';
import getDeprecatedProperty from '../deprecated.js';
import { example } from '../example';

const attributes = {
Expand Down Expand Up @@ -64,6 +63,4 @@ registerBlockType( 'woocommerce/reviews-by-product', {
* Save the props to post content.
*/
save,

deprecated: getDeprecatedProperty( attributes ),
} );

0 comments on commit 28b72d2

Please sign in to comment.