Simplified export bookkeeping
This commit is contained in:
parent
832542c1c5
commit
f08d9bf9c1
9 changed files with 58 additions and 68 deletions
|
@ -57,6 +57,7 @@ export default class Project {
|
|||
historic: config.state ?? {
|
||||
sheetsById: {},
|
||||
definitionVersion: globals.currentProjectStateDefinitionVersion,
|
||||
revisionHistory: [],
|
||||
},
|
||||
ephemeral: {
|
||||
loadingState: {
|
||||
|
|
|
@ -7,7 +7,7 @@ import globals from '@theatre/shared/globals'
|
|||
|
||||
/**
|
||||
* @todo this could be turned into a simple derivation, like:
|
||||
* editor.isReady: IDerivation<{isReady: true} | {isReady: false, readon: 'conflictBetweenDiskStateAndBrowserState'}>
|
||||
* editor.isReady: IDerivation<{isReady: true} | {isReady: false, reason: 'conflictBetweenDiskStateAndBrowserState'}>
|
||||
*/
|
||||
export default async function initialiseProjectState(
|
||||
studio: Studio,
|
||||
|
@ -42,6 +42,7 @@ export default async function initialiseProjectState(
|
|||
drafts.historic.coreByProject[projectId] = {
|
||||
sheetsById: {},
|
||||
definitionVersion: globals.currentProjectStateDefinitionVersion,
|
||||
revisionHistory: [],
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,9 +82,8 @@ export default async function initialiseProjectState(
|
|||
useBrowserState()
|
||||
} else {
|
||||
if (
|
||||
!browserState.exportBookkeeping ||
|
||||
browserState.exportBookkeeping.basedOnRevisions.indexOf(
|
||||
onDiskState.exportBookkeeping.revision,
|
||||
browserState.revisionHistory.indexOf(
|
||||
onDiskState.revisionHistory[onDiskState.revisionHistory.length - 1],
|
||||
) == -1
|
||||
) {
|
||||
browserStateIsNotBasedOnDiskState(onDiskState)
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
import type {StrictRecord} from '@theatre/shared/utils/types'
|
||||
import type {SheetState_Historic} from './types/SheetState_Historic'
|
||||
|
||||
export interface ProjectLoadedState {
|
||||
type: 'loaded'
|
||||
}
|
||||
|
||||
type ProjectLoadingState =
|
||||
| {type: 'loading'}
|
||||
| ProjectLoadedState
|
||||
| {type: 'loaded'}
|
||||
| {
|
||||
type: 'browserStateIsNotBasedOnDiskState'
|
||||
onDiskState: OnDiskState
|
||||
|
@ -34,7 +30,11 @@ export interface ProjectEphemeralState {
|
|||
*/
|
||||
export interface ProjectState_Historic {
|
||||
sheetsById: StrictRecord<string, SheetState_Historic>
|
||||
exportBookkeeping?: {revision: string; basedOnRevisions: string[]}
|
||||
/**
|
||||
* The last 50 revision IDs this state is based on, starting with the most recent one.
|
||||
* The most recent one is the revision ID of this state
|
||||
*/
|
||||
revisionHistory: string[]
|
||||
definitionVersion: string
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,4 @@ export interface ProjectState {
|
|||
ephemeral: ProjectEphemeralState
|
||||
}
|
||||
|
||||
export interface OnDiskState extends ProjectState_Historic {
|
||||
exportBookkeeping: {revision: string; basedOnRevisions: string[]}
|
||||
}
|
||||
export interface OnDiskState extends ProjectState_Historic {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue