Merge pull request #259 from mirumee/fix/product-description

Fix disappearing products description
This commit is contained in:
Marcin Gębala 2019-11-19 13:17:02 +01:00 committed by GitHub
commit 89cdb9419d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View file

@ -10,6 +10,7 @@ All notable, unreleased changes to this project will be documented in this file.
- Fix subcategories pagination - #249 by @dominik-zeglen - Fix subcategories pagination - #249 by @dominik-zeglen
- Update customer's details page design - #248 by @dominik-zeglen - Update customer's details page design - #248 by @dominik-zeglen
- Use Apollo Hooks - #254 by @dominik-zeglen - Use Apollo Hooks - #254 by @dominik-zeglen
- Fix disappearing products description - #259 by @dominik-zeglen
## 2.0.0 ## 2.0.0

View file

@ -112,7 +112,11 @@ export const ProductCreatePage: React.FC<ProductCreatePageProps> = ({
set: setAttributeData set: setAttributeData
} = useFormset<ProductAttributeInputData>([]); } = useFormset<ProductAttributeInputData>([]);
const initialDescription = convertToRaw(ContentState.createFromText("")); // Ensures that it will not change after component rerenders, because it
// generates different block keys and it causes editor to lose its content.
const initialDescription = React.useRef(
convertToRaw(ContentState.createFromText(""))
);
const initialData: FormData = { const initialData: FormData = {
basePrice: 0, basePrice: 0,
category: "", category: "",
@ -219,7 +223,7 @@ export const ProductCreatePage: React.FC<ProductCreatePageProps> = ({
data={data} data={data}
disabled={disabled} disabled={disabled}
errors={errors} errors={errors}
initialDescription={initialDescription} initialDescription={initialDescription.current}
onChange={change} onChange={change}
/> />
<CardSpacer /> <CardSpacer />