Skip to content

Commit 4dbfbfd

Browse files
show spinner while still loading dynamic content in editor
1 parent 85d43fd commit 4dbfbfd

File tree

2 files changed

+4
-2
lines changed
  • src

2 files changed

+4
-2
lines changed

src/block-components/typography/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { useDynamicContent } from '~stackable/components/dynamic-content-control
2020
/**
2121
* WordPress dependencies
2222
*/
23+
import { Spinner } from '@wordpress/components'
2324
import { RichText } from '@wordpress/block-editor'
2425
import {
2526
useEffect,
@@ -92,6 +93,9 @@ export const Typography = memo( forwardRef( ( props, ref ) => {
9293
}, [ debouncedText, onChange ] ) // Don't include `value` in the dependency list because it will cause a double triggering of the `onChange`.
9394

9495
const dynamicContentText = useDynamicContent( debouncedText )
96+
if ( dynamicContentText.includes( 'data-stk-dynamic=' ) && dynamicContentText.includes( '></span>' ) ) {
97+
return <Spinner />
98+
}
9599

96100
if ( ! editable ) {
97101
return <TagName className={ className }>{ dynamicContentText }</TagName>

src/components/dynamic-content-control/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,6 @@ export const useDynamicContent = ( value = '' ) => {
242242
...select( 'core/block-editor' ).getBlock( clientId ),
243243
context: useContext( QueryLoopContext ),
244244
}
245-
// const queryLoopContext =
246-
// blockDetails.context = { ...context }
247245

248246
return useSelect( select => {
249247
if ( ! value || ! isString( value ) ) {

0 commit comments

Comments
 (0)