GibbonEdu / core

Gibbon is a flexible, open source school management platform designed to make life better for teachers, students, parents and leaders.
https://gibbonedu.org
GNU General Public License v3.0
452 stars 295 forks source link

Auto save feature for modules/Planner/planner_add.php #1811

Closed hsh2001 closed 3 months ago

hsh2001 commented 4 months ago

Description

Auto saving planner data!

Motivation and Context

It solves the problem of losing the data we're working on when we navigate to another page while writing information.

How Has This Been Tested?

Write some data, and I check these datas are saved in session.

Screenshots

스크린샷 2024-03-18 오후 5 56 54
hsh2001 commented 4 months ago

Thank you for comment @SKuipers :)

Yes, I need to use debounce for onKeyDown callback! I will update it and request a review again!

hsh2001 commented 3 months ago

Hello @SKuipers !

Nice comment, I 100% agree with you! I will fix it!

hsh2001 commented 3 months ago

@SKuipers First of all, thank you for your thorough review of the code and for your nice comments. However, I think you are mistaken about something.

This is Debounce, so it doesn't send a request every 300 milliseconds. According to Debounce logic, it shouldn't send a request until 300 milliseconds of inactivity have passed. Sending a request every 300 milliseconds is throttling logic. If we increased the duration to 5-15 seconds, the user would have to wait 5-15 seconds without taking any action before the autosave would be triggered. (I think this would be very rare.) I don't think this would fulfill our intention of improving the frustrating experience of accidentally clicking another link while writing and losing what user are writing.

What do you think?

hsh2001 commented 3 months ago

Thank you for check @SKuipers !

Please review again!

SKuipers commented 3 months ago

Hi @hsh2001 Thanks again for your work on this! I'm just going to merge it in now. My apologies for the delays with code review, it's been a busy couple weeks leading up to Easter break here. Huge thanks!

hsh2001 commented 3 months ago

Thank you @SKuipers :)