Skip to content

Commit

Permalink
fix(ssr): by passing intl by passing from extendedSchema function
Browse files Browse the repository at this point in the history
  • Loading branch information
ichim-david committed Aug 29, 2023
1 parent 13f2685 commit b69612a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
18 changes: 3 additions & 15 deletions src/components/manage/Blocks/Accordion/LayoutSchema.js
@@ -1,4 +1,4 @@
import { defineMessages, createIntlCache, createIntl } from 'react-intl';
import { defineMessages } from 'react-intl';

const messages = defineMessages({
AccordionBlockSettings: {
Expand Down Expand Up @@ -110,17 +110,7 @@ const messages = defineMessages({
},
});

const cache = createIntlCache();

const intl = createIntl(
{
locale: 'en',
messages: messages,
},
cache,
);

const Schema = {
export default (intl) => ({
title: intl.formatMessage(messages.AccordionBlockSettings),
fieldsets: [
{
Expand Down Expand Up @@ -217,6 +207,4 @@ const Schema = {
},
},
required: [],
};

export default Schema;
});
7 changes: 4 additions & 3 deletions src/index.js
Expand Up @@ -43,13 +43,14 @@ const extendedSchema = (config) => {
.filter((val) => !!val);

choices.push(['accordion', intl.formatMessage(messages.accordionTitle)]);
const accordionLayoutSchema = AccordionLayoutSchema(intl);

return {
...AccordionLayoutSchema,
...accordionLayoutSchema,
properties: {
...AccordionLayoutSchema.properties,
...accordionLayoutSchema.properties,
allowedBlocks: {
...AccordionLayoutSchema.properties.allowedBlocks,
...accordionLayoutSchema.properties.allowedBlocks,
items: {
choices: choices,
},
Expand Down

0 comments on commit b69612a

Please sign in to comment.