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

[#12749] Autosave and restore progress if user navigates away #13140

Merged
merged 19 commits into from
Jul 23, 2024

Conversation

Respirayson
Copy link
Contributor

Fixes #12749

Outline of Solution

Description

This PR introduces autosave functionality for this feedback session page. The way that I implemented it ensures that users' responses are automatically saved after they have made a change.

Some key changes

1. Autosave Implementation

  • Added autosave method + events to handle the autosaving of feedback responses to local storage
  • Used timeout that is started upon change in input because periodic intervals might create a potential window where the user refreshes the page before the save kicks in. And saving every input change might waste resources. So I feel that this is a best of both worlds approach to saving the data.

2. Loading autosaved data

  • Lazy loading of feedback session only when the question itself is in the viewport

3. Reset

  • Added a way for users to reset their response to the last submitted state so I like to think of it as a git reset --hard to help users get back to the original previous data that they had.
  • And I also made a few UI changes to add the buttons in to reset the data

Video Demo

Below is a video showcasing a really quick demo of what I've done:
https://github.com/Respirayson/teammates/assets/88478542/5eb944dc-37b2-4925-9b49-f46c22991558

And some screenshots:

Tooltip for relevant info
image

Reset button disabled when there are no changes
image

Also updated the grouped and ungrouped questions' UI
image

Copy link
Contributor

@domoberzin domoberzin left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, I think this is a really neat feature to have, but I have some comments on it.

Upon testing, it seems that the autosave works on the preview setting (preview as student) as well, however the reset button doesnt work in preview mode, and I'd have to manually delete the data for it to clear. I've attached a video snippet for your reference (apologies for the bad quality, had to fit it within 10mb, let me know if its too hard to see and ill re-record). Since this is just for previews, one method would be to disable this autosave mechanism when the feedback session is being previewed.

Screen.Recording.2024-07-11.at.11.26.48-1.mov

Copy link
Contributor

@domoberzin domoberzin left a comment

Choose a reason for hiding this comment

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

LGTM, just a tiny nit. Good work on this

@domoberzin
Copy link
Contributor

@Respirayson could you fix the failing component tests by updating the snapshots? thanks

Copy link
Contributor

@domoberzin domoberzin left a comment

Choose a reason for hiding this comment

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

LGTM! Great work

@domoberzin domoberzin merged commit 67628fb into TEAMMATES:master Jul 23, 2024
11 checks passed
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.

Autosave and restore progress if user navigates away
3 participants