Skip the random ID for regular history entries (#3183)

Non-mark history entries don't need a random id. 🤷‍♂️

### Change Type

- [x] `sdk` — Changes the tldraw SDK
- [ ] `dotcom` — Changes the tldraw.com web app
- [ ] `docs` — Changes to the documentation, examples, or templates.
- [ ] `vs code` — Changes to the vscode plugin
- [ ] `internal` — Does not affect user-facing stuff

<!--  Please select a 'Type' label ️ -->

- [ ] `bugfix` — Bug fix
- [ ] `feature` — New feature
- [x] `improvement` — Improving existing features
- [ ] `chore` — Updating dependencies, other boring stuff
- [ ] `galaxy brain` — Architectural changes
- [ ] `tests` — Changes to any test code
- [ ] `tools` — Changes to infrastructure, CI, internal scripts,
debugging tools, etc.
- [ ] `dunno` — I don't know
pull/3185/head
Steve Ruiz 2024-03-18 07:56:53 +00:00 zatwierdzone przez GitHub
rodzic 4801b35768
commit 176fdb5425
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
4 zmienionych plików z 3 dodań i 7 usunięć

Wyświetl plik

@ -1964,7 +1964,6 @@ export type TLCollaboratorHintProps = {
// @public (undocumented)
export type TLCommand<Name extends string = any, Data = any> = {
type: 'command';
id: string;
data: Data;
name: Name;
preservesRedoStack?: boolean;

Wyświetl plik

@ -35941,7 +35941,7 @@
},
{
"kind": "Content",
"text": "{\n type: 'command';\n id: string;\n data: Data;\n name: Name;\n preservesRedoStack?: boolean;\n}"
"text": "{\n type: 'command';\n data: Data;\n name: Name;\n preservesRedoStack?: boolean;\n}"
},
{
"kind": "Content",

Wyświetl plik

@ -82,7 +82,6 @@ export class HistoryManager<
this._undos.update((undos) =>
undos.tail.push({
...prev,
id: uniqueId(),
data: devFreeze(handle.squash!(prev.data, data)),
})
)
@ -93,7 +92,6 @@ export class HistoryManager<
type: 'command',
name,
data: devFreeze(data),
id: uniqueId(),
preservesRedoStack: preservesRedoStack,
})
)
@ -117,9 +115,9 @@ export class HistoryManager<
this._batchDepth++
if (this._batchDepth === 1) {
transact(() => {
const mostRecentActionId = this._undos.get().head?.id
const mostRecentAction = this._undos.get().head
fn()
if (mostRecentActionId !== this._undos.get().head?.id) {
if (mostRecentAction !== this._undos.get().head) {
this.onBatchComplete()
}
})

Wyświetl plik

@ -25,7 +25,6 @@ export type TLHistoryMark = {
/** @public */
export type TLCommand<Name extends string = any, Data = any> = {
type: 'command'
id: string
data: Data
name: Name
/**