icssc / AntAlmanac

A course exploration and scheduling tool for UCI Anteaters
https://antalmanac.com
MIT License
56 stars 70 forks source link

Warning prompts without adding any classes #914

Closed MinhxNguyen7 closed 5 months ago

MinhxNguyen7 commented 7 months ago

Description

It seems that any key press is causing the unsaved warning to show up. This includes either typing in the search bar or into the schedule load modal.

Related

865 might have changed the way that save states work, and I do remember seeing some weird code in there. @stevem-zhou do you have any ideas?

KevinWu098 commented 7 months ago

@MinhxNguyen7 #865 hasn't been merged in yet, nor has its successor #891

KevinWu098 commented 7 months ago

Can't reproduce the error, is there a video you could share of the behavior?

MinhxNguyen7 commented 7 months ago

@KevinWu098 I can make a video, but try it jn incognito. I reproduced it on a different device as well, so it's not just me

KevinWu098 commented 7 months ago

@KevinWu098 I can make a video, but try it jn incognito. I reproduced it on a different device as well, so it's not just me

export function removeSampleClasses() {
    AppStore.deleteCourses(sampleClassesSectionCodes, CURRENT_TERM);
    sampleClassesSectionCodes = [];
}

@MinhxNguyen7 This is the offending bit of code; It triggers this.unsavedChanges = true; You can reproduce for yourself by just slapping a console.log on every function with this.unsavedChanges = true and seeing which triggers on load.

    deleteCourses(sectionCodes: string[], term: string) {
        sectionCodes.forEach((sectionCode) => this.deleteCourse(sectionCode, term));

        console.log('deleteCourses');

        this.unsavedChanges = true;
        this.emit('addedCoursesChange');
    }
KevinWu098 commented 7 months ago

Since deleteCourses is only used by the Tutorial... the quickest fix would just be to omit this.unsavedChanges = true;, but I've got a hunch that it could potentially cause hassle in the future if not properly documented.

Thoughts?

MinhxNguyen7 commented 7 months ago

So it was me lmao

I'll look at it when I get back to my computer

KevinWu098 commented 7 months ago

So it was me lmao

I'll look at it when I get back to my computer

image