Merge pull request #15967 from ramonlsouza/update-slide-on-change

fix: issue with slides not changing after upload
This commit is contained in:
Ramón Souza 2022-11-08 16:38:28 -03:00 committed by GitHub
commit 31beac8df3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -93,6 +93,7 @@ export default function Whiteboard(props) {
zoomValue,
isPanning,
intl,
svgUri,
} = props;
const { pages, pageStates } = initDefaultPages(curPres?.pages.length || 1);
@ -113,6 +114,7 @@ export default function Whiteboard(props) {
const prevShapes = usePrevious(shapes);
const prevSlidePosition = usePrevious(slidePosition);
const prevFitToWidth = usePrevious(fitToWidth);
const prevSvgUri = usePrevious(svgUri);
const language = mapLanguage(Settings?.application?.locale?.toLowerCase() || 'en');
const calculateZoom = (width, height) => {
@ -226,7 +228,7 @@ export default function Whiteboard(props) {
changed = true;
}
if (curPageId && !next.assets[`slide-background-asset-${curPageId}`]) {
if (curPageId && (!next.assets[`slide-background-asset-${curPageId}`]) || (svgUri && !_.isEqual(prevSvgUri, svgUri))) {
next.assets[`slide-background-asset-${curPageId}`] = assets[`slide-background-asset-${curPageId}`]
tldrawAPI?.patchState(
{