Skip to content

Commit

Permalink
Use hook on init to properly set global vars
Browse files Browse the repository at this point in the history
At this point `wp.data.dispatch('core/editor')` is available React is not rendered yet so we can properly override the savePost function.
  • Loading branch information
JoryHogeveen committed Oct 14, 2024
1 parent 14f4da4 commit 17610dd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ui/js/dfv/src/core/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@ import ConnectedFieldWrapper from 'dfv/src/components/connected-field-wrapper';
* Pods config
*/
import { FIELD_PROP_TYPE_SHAPE } from 'dfv/src/config/prop-types';
import useBlockEditor from '../hooks/useBlockEditor';

const App = ( {
storeKey,
} ) => {
const fieldsData = PodsDFVAPI._fieldDataByStoreKeyPrefix[ storeKey ];
const allPodFieldsMap = new Map( fieldsData.map( ( field ) => [ field.name, field ] ) );

// Initialize Pods Block Editor overrides if available.
useBlockEditor();

const fieldComponents = fieldsData.map( ( fieldData = {} ) => {
const {
directRender = false,
Expand Down

0 comments on commit 17610dd

Please sign in to comment.