Properly load entries when switching collections
This commit is contained in:
parent
9bd6fb49d1
commit
24e68d8ed8
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@simplecms/simple-cms-core",
|
||||
"version": "0.1.2",
|
||||
"version": "0.1.3",
|
||||
"license": "MIT",
|
||||
"description": "Simple CMS core application.",
|
||||
"repository": "https://github.com/SimpleCMS/simple-cms",
|
||||
|
@ -104,7 +104,12 @@ const CollectionView = ({
|
||||
|
||||
const renderEntriesCollection = useCallback(() => {
|
||||
return (
|
||||
<EntriesCollection collection={collection} viewStyle={viewStyle} filterTerm={filterTerm} readyToLoad={readyToLoad} />
|
||||
<EntriesCollection
|
||||
collection={collection}
|
||||
viewStyle={viewStyle}
|
||||
filterTerm={filterTerm}
|
||||
readyToLoad={readyToLoad}
|
||||
/>
|
||||
);
|
||||
}, [collection, filterTerm, viewStyle, readyToLoad]);
|
||||
|
||||
|
@ -80,7 +80,7 @@ class EntriesCollection extends React.Component {
|
||||
|
||||
componentDidUpdate(prevProps) {
|
||||
const { collection, entriesLoaded, loadEntries, readyToLoad } = this.props;
|
||||
if (!entriesLoaded && readyToLoad && !prevProps.readyToLoad) {
|
||||
if (!entriesLoaded && readyToLoad && (!prevProps.readyToLoad || prevProps.collection !== collection)) {
|
||||
loadEntries(collection);
|
||||
}
|
||||
}
|
||||
|
@ -571,7 +571,7 @@ Example usage:
|
||||
```javascript
|
||||
CMS.registerEventListener({
|
||||
name: 'prePublish',
|
||||
handler: ({ author, entry }) => console.log(JSON.stringify({ author, data: entry.get('data') })),
|
||||
handler: ({ author, entry }) => console.info(JSON.stringify({ author, data: entry.get('data') })),
|
||||
});
|
||||
```
|
||||
|
||||
|
@ -82,7 +82,7 @@ function EventBox({ title, cta }) {
|
||||
setLoading(false);
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err); // eslint-disable-line no-console
|
||||
console.error(err); // eslint-disable-line no-console
|
||||
// TODO: set state to show error message
|
||||
|
||||
setLoading(false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user