Skip to content

Commit

Permalink
feat: add bg color to status
Browse files Browse the repository at this point in the history
  • Loading branch information
razvanMiu committed Dec 14, 2023
1 parent cc2cf3a commit 1f432cf
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions src/components/theme/AppExtras/RemoveSchema.jsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
import { useEffect } from 'react';
import { connect } from 'react-redux';
import { removeSchema } from '@eeacms/volto-eea-website-theme/actions';
import { flattenToAppURL } from '@plone/volto/helpers';

function RemoveSchema({ removeSchema, content, schema }) {
function RemoveSchema({ removeSchema, contentLoading, content, schema }) {
useEffect(() => {
if (
!schema.loading &&
!contentLoading &&
schema.schema &&
(!content || (content && schema.contentType !== content['@type']))
(!content ||
(content && schema.contentUrl !== flattenToAppURL(content['@id'])))
) {
removeSchema();
}
}, [removeSchema, content, schema]);
}, [removeSchema, content, contentLoading, schema]);

return null;
}

export default connect(
(state) => ({
content: state.content.data,
contentLoading: state.content.get.loading,
schema: state.schema,
}),
{ removeSchema },
Expand Down
2 changes: 1 addition & 1 deletion src/middleware/apiEnhancer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default function apiEnhencar(middlewares) {
export default function apiEnhencer(middlewares) {
return [
() => (next) => (action) => {
if (action.request) {
Expand Down
2 changes: 1 addition & 1 deletion src/reducers/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function schema(state = initialState, action = {}) {
...state,
error: null,
loading: false,
loaded: true,
loaded: false,
schema: null,
};
}
Expand Down

0 comments on commit 1f432cf

Please sign in to comment.