wip: ignore restore on update for first load of initial presentation
This commit is contained in:
parent
a7d78109b2
commit
854d0a162e
@ -77,6 +77,7 @@ class Presentation extends PureComponent {
|
||||
isPanning: false,
|
||||
tldrawIsMounting: true,
|
||||
isToolbarVisible: true,
|
||||
hadPresentation: false,
|
||||
};
|
||||
|
||||
this.currentPresentationToastId = null;
|
||||
@ -136,9 +137,15 @@ class Presentation extends PureComponent {
|
||||
window.addEventListener('resize', this.onResize, false);
|
||||
|
||||
const {
|
||||
currentSlide, slidePosition, numPages, layoutContextDispatch,
|
||||
currentSlide, slidePosition, numPages, layoutContextDispatch, currentPresentationId,
|
||||
} = this.props;
|
||||
|
||||
if (currentPresentationId) {
|
||||
this.setState({
|
||||
hadPresentation: true
|
||||
});
|
||||
}
|
||||
|
||||
if (currentSlide) {
|
||||
layoutContextDispatch({
|
||||
type: ACTIONS.SET_PRESENTATION_NUM_CURRENT_SLIDE,
|
||||
@ -178,7 +185,7 @@ class Presentation extends PureComponent {
|
||||
} = this.props;
|
||||
|
||||
const {
|
||||
presentationWidth, presentationHeight, zoom, isPanning, fitToWidth, presentationId,
|
||||
presentationWidth, presentationHeight, zoom, isPanning, fitToWidth, presentationId, hadPresentation,
|
||||
} = this.state;
|
||||
const {
|
||||
numCameras: prevNumCameras,
|
||||
@ -258,22 +265,28 @@ class Presentation extends PureComponent {
|
||||
});
|
||||
}
|
||||
const presentationChanged = presentationId !== currentPresentationId;
|
||||
if (presentationChanged) {
|
||||
this.setState({
|
||||
presentationId: currentPresentationId,
|
||||
});
|
||||
}
|
||||
|
||||
// TODO: this information should be received from server
|
||||
const isInitialPresentation = currentPresentation.name === 'default.pdf';
|
||||
|
||||
if (!presentationIsOpen && restoreOnUpdate && (currentSlide || presentationChanged)) {
|
||||
const slideChanged = currentSlide.id !== prevProps.currentSlide.id;
|
||||
const positionChanged = slidePosition
|
||||
.viewBoxHeight !== prevProps.slidePosition.viewBoxHeight
|
||||
|| slidePosition.viewBoxWidth !== prevProps.slidePosition.viewBoxWidth;
|
||||
const pollPublished = publishedPoll && !prevProps.publishedPoll;
|
||||
if (slideChanged || positionChanged || pollPublished || presentationChanged) {
|
||||
if (slideChanged || positionChanged || pollPublished || (presentationChanged && (hadPresentation || !isInitialPresentation))) {
|
||||
setPresentationIsOpen(layoutContextDispatch, !presentationIsOpen);
|
||||
}
|
||||
}
|
||||
|
||||
if (presentationChanged) {
|
||||
this.setState({
|
||||
presentationId: currentPresentationId,
|
||||
hadPresentation: true
|
||||
});
|
||||
}
|
||||
|
||||
if ((presentationBounds !== prevPresentationBounds)
|
||||
|| (!presentationWidth && !presentationHeight)) this.onResize();
|
||||
} else if (slidePosition) {
|
||||
|
Loading…
Reference in New Issue
Block a user