-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
[#10788] Instructor view student list: incorrect state shown very briefly (feedback session page) #10871
[#10788] Instructor view student list: incorrect state shown very briefly (feedback session page) #10871
Conversation
I am wondering what is the need for the extra flag here. Why not just render the component only when |
You have a point. Originally I assumed if courses aren't loading, it can either be that (i) the courses are already successfully loaded or (ii) the courses failed to load. However, looking back at the code I realise the only time Conclusion: I have updated the PR to reflect the following changes:
|
…10788-feedback-session-second-approach
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
In the future, if the bug/change happens very quickly, you can throttle your speed in developer console or add a pipe/delay to the component manually
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work 👍
However, I believe we can improve this further.
We know that an instructor needs courses to be loaded before he can create a session. The current solution allows for the instructor to still click on Add Session
where he will be waiting before he can create anything. This behaviour will still be puzzling as he will find himself not being able to do anything (even if there is no explicit error).
Instead of the current proposal, why not disable the add button till sessions are loaded? This makes more sense from an end-user perspective as the user will see a loading icon and will realise he has to wait first. It also does not add an extra variable as @Input()
to our session edit form component.
…10788-feedback-session-second-approach
Hi @rrtheonlyone do you mean we disable the 'Add New Feedback Session' button until courses are created/exists (i.e. at least one course available)? |
No I was thinking disable till the courses have been loaded. Do you think that will work? |
I see, I think it will work, let me have a go at it. |
…10788-feedback-session-second-approach
Sorry I realise this doesn't work as the problem still exists if the user does the following:
I will like to propose a different approach, which is to load the session edit form only when Advantages of this approach over using a boolean flag:
|
Your approach works and I am fine with it. Although I still feel disabling till it loads is cleaner and will be more natural for a user (he/she will know that the button cannot be clicked till the loading icon is finished). With regards to the refreshing, I tried it myself and it seems to work. When the page refreshes, does it not just refetch the courses again? (so the button goes back to being disabled till its fetched) |
Yep I agree with this part, although it lasts for only a fraction of a second on my computer but still I guess loading time varies between devices and should be taken into account.
Yes the button will go back to being disabled once refreshed until courses are fetched. Assuming that the session edit form is in the collapsed state, it will be perfectly fine. However, there's another situation where the session edit form might be expanded already when the user refreshes, that's why I proposed to only expand the session edit form when the courses are loaded. I have updated the PR to disable the Add New Session button when courses are still loading. |
Steps to reproduce the above? Even if it is expanded, I believe it goes back to being closed on page refresh. |
Ah yes your right.. I wonder: what about going with a combination of both? You disable the button and not load the session edit form while courses are being fetched from API. This way we can resolve this issue. |
Yes! The current solution incorporates both, the button is disabled when the courses are loading and the edit section will expand once the courses are loaded. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 💯 Great work!
Fixes #10788
Outline of solution:
hasCourseLoaded
, set totrue
once the courses are successfully fetched from the server. Originally, there were only two flagsisCoursesLoading
andhasCourseLoadingFailed
.hasCourseLoaded
flag in conjunction with the length of thecourseCandidates
array to decide whether an error message should be displayed.Before (notice the red outline around the select drop-down that appears for half a second):
After: