Skip to content
This repository has been archived by the owner on Jun 28, 2021. It is now read-only.

Commit

Permalink
Merge pull request #68 from TakwimuAfrica/fix-snippet-select
Browse files Browse the repository at this point in the history
[Bug] Fix snippet select
  • Loading branch information
KhadijaMahanga authored Mar 10, 2020
2 parents 12fee8f + 15c341f commit 520e9e0
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions wp-content/plugins/hurumap/src/CardBlock/Edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import { PanelBody, SelectControl, TextControl } from '@wordpress/components';
import { InspectorControls } from '@wordpress/editor';

import Card from '@codeforafrica/hurumap-ui/components/Card';
import { InputLabel } from '@material-ui/core';

import { select } from '@wordpress/data';
import Select from 'react-select';
import shortid from 'shortid';
import withRoot from '../withRoot';
import propTypes from '../propTypes';
Expand Down Expand Up @@ -51,7 +53,9 @@ function Edit({
let result;
function getRecord() {
setTimeout(() => {
result = getEntityRecord('postType', propPostType, propPostId);
result = getEntityRecord('postType', propPostType, propPostId, {
per_page: -1
});
if (!result) {
getRecord();
} else {
Expand Down Expand Up @@ -87,18 +91,13 @@ function Edit({
value={postType}
onChange={setPostType}
/>
<SelectControl
label={__('Post', 'hurumap')}
options={[
{
label: 'Select post'
},
...posts.map(p => ({
value: p.id,
label: p.title.rendered
}))
]}
<InputLabel shrink>Post</InputLabel>
<Select
value={propPostId}
options={posts.map(p => ({
value: p.id,
label: p.title.rendered
}))}
onChange={handleSelectPost}
/>
<TextControl
Expand Down

0 comments on commit 520e9e0

Please sign in to comment.