mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-12 08:58:15 +00:00
fix: 修复初始页面就有两条历史记录
This commit is contained in:
parent
251b5c496e
commit
c21aeb9a5c
@ -86,7 +86,7 @@ export class DocumentModel {
|
||||
}
|
||||
|
||||
get fileName(): string {
|
||||
return this.rootNode?.getExtraProp('fileName')?.getAsString() || this.id;
|
||||
return this.rootNode?.getExtraProp('fileName', false)?.getAsString() || this.id;
|
||||
}
|
||||
|
||||
set fileName(fileName: string) {
|
||||
|
||||
@ -43,21 +43,20 @@ export class History {
|
||||
if (this.asleep) return;
|
||||
untracked(() => {
|
||||
const log = currentSerialization.serialize(data);
|
||||
if (this.session.isActive()) {
|
||||
this.session.log(log);
|
||||
} else {
|
||||
this.session.end();
|
||||
const lastState = this.getState();
|
||||
const cursor = this.session.cursor + 1;
|
||||
const session = new Session(cursor, log, this.timeGap);
|
||||
this.session = session;
|
||||
this.records.splice(cursor, this.records.length - cursor, session);
|
||||
const currentState = this.getState();
|
||||
if (currentState !== lastState) {
|
||||
this.emitter.emit('statechange', currentState);
|
||||
}
|
||||
if (this.session.isActive()) {
|
||||
this.session.log(log);
|
||||
} else {
|
||||
this.session.end();
|
||||
const lastState = this.getState();
|
||||
const cursor = this.session.cursor + 1;
|
||||
const session = new Session(cursor, log, this.timeGap);
|
||||
this.session = session;
|
||||
this.records.splice(cursor, this.records.length - cursor, session);
|
||||
const currentState = this.getState();
|
||||
if (currentState !== lastState) {
|
||||
this.emitter.emit('statechange', currentState);
|
||||
}
|
||||
// }
|
||||
}
|
||||
});
|
||||
}, { fireImmediately: true });
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user