Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: colorpicker no longer closes on click #851

Merged
merged 1 commit into from
Jan 8, 2024

Conversation

KevinWu098
Copy link
Member

@KevinWu098 KevinWu098 commented Jan 4, 2024

Summary

  1. Bug was introduced by the refactor in feat: Add 24 Hour Time Format #775
    updateEventsInCalendar = (close = true) => {
        this.setState({
            currentScheduleIndex: AppStore.getCurrentScheduleIndex(),
            eventsInCalendar: AppStore.getEventsInCalendar(),
            finalsEventsInCalendar: AppStore.getFinalEventsInCalendar(),
        });
        if (close) this.handleClosePopover();
    };

    ...

     componentDidMount = () => {
        AppStore.on('addedCoursesChange', this.updateEventsInCalendar);
        AppStore.on('customEventsChange', this.updateEventsInCalendar);
        AppStore.on('colorChange', this.updateEventsInCalendar);
        AppStore.on('currentScheduleIndexChange', this.updateEventsInCalendar);
        AppStore.on('scheduleNamesChange', this.updateScheduleNames);
    };

    componentWillUnmount = () => {
        AppStore.removeListener('addedCoursesChange', this.updateEventsInCalendar);
        AppStore.removeListener('customEventsChange', this.updateEventsInCalendar);
        AppStore.removeListener('colorChange', this.updateEventsInCalendar);
        AppStore.removeListener('currentScheduleIndexChange', this.updateEventsInCalendar);
        AppStore.removeListener('scheduleNamesChange', this.updateScheduleNames);
    };

Previously, handleClosePopover() would never be triggered as close always evaluated to false, even when no param was passed into updateEventsInCalendar. In the refactor, I omitted a check, since I expected nothing would change... haha

To whomever is reviewing this PR, if you can explain to me why that is the case when close = true in the snippet, please let me know.

Test Plan

  1. Color Picker shouldn't close on the Calendar Root when clicked.
  2. Popovers should close when events are changed and when index changes.

Issues

Bug Report: https://discord.com/channels/772739905981644850/780316580819107860/1192200165948395561

@github-actions github-actions bot requested a review from stevenguyukai January 4, 2024 04:10
Copy link
Member

@andrew-wang0 andrew-wang0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
- KEvin Wu

@KevinWu098 KevinWu098 merged commit b08e18e into main Jan 8, 2024
7 checks passed
@EricPedley EricPedley deleted the calendar-colorpicker-close branch February 6, 2024 05:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants