-
Notifications
You must be signed in to change notification settings - Fork 227
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Issue Category
Compilation Bug
Bug Description
Error: [Ripple] Cannot set properties of undefined (setting 'tracking')
export class UndoRedoState {
constructor(val) {
this.history = #[];
this.currentIdx = track(-1);
this.currentState = track(() => this.history[this.@currentIdx]);
this.canUndo = track(() => this.@currentIdx > 0);
this.canRedo = track(() => this.@currentIdx < this.history.length - 1);
this.canReset = track(() => this.@canUndo || this.@canRedo);
this.length = track(() => this.history.length);
this.isAtLatestState = track(() => this.@currentIdx === this.history.length - 1);
this.state = val;
}
get state() {
return this.@currentState;
}
set state(val) {
if (!this.@isAtLatestState) this.history.splice(this.@currentIdx + 1);
this.history[++this.@currentIdx] = val;
}
undo() {
if (!this.@canUndo) return;
this.@currentIdx--;
}
redo() {
if (!this.@canRedo) return;
this.@currentIdx++;
}
goto(idx) {
this.@currentIdx = idx;
}
reset() {
if (!this.@canReset) return;
this.@currentIdx = 0;
this.history.splice(1);
}
toString() {
return JSON.stringify({
history: this.history,
currentIdx: this.@currentIdx,
currentState: this.@currentState,
}, null, 2);
}
}
Error is seen because Ripple is bugging out when compiling this class
Reproduction Steps
Environment
Additional Context
No response
Checklist
- I've searched for existing issues
- I'm willing to help implement a fix
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working