-
Notifications
You must be signed in to change notification settings - Fork 699
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
Update folder selection logic to handle deep folders. #12381
Conversation
Fix issues with selection and deselection.
Build Artifacts
|
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.
Code changes overall LGTM - just left some non-blocking questions/comments.
I'll give it a manual review before approving
kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ResourceSelection.vue
Show resolved
Hide resolved
// If we don't have all of the children locally, we need to fetch them | ||
const children = await ContentNodeResource.fetchCollection({ |
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.
Haven't tested yet - but just wondering what this might look like on a slow connection and if we might want to add a loading state here.
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.
With that said, we probably need to work on adding loading states in various places...
2024-07-01.15-05-33.mp4
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.
I think we can probably polish things in a follow-up - I left one typically blocking comment on a confusing UX.
Another thing that occurred to me is that a user can ultimately build up a large number of replacements. I'm curious to see how this performs on lower-end devices (separately from slower networks).
On my device, making a section with 50 questions and ~380 total replacements and then opening the replacements side panel, it takes AccordionContainer
3s to mount:
Perhaps we can also find a way to optimize/improve the AccordionContainer altogether -- perhaps the issue is actually the transition group?
if ( | ||
contentPresentInWorkingResourcePool(node) || | ||
contentPartlyPresentInWorkingResourcePool(node) | ||
) { | ||
// If a node has been selected or partly selected, always allow it to be deselected. | ||
return true; | ||
} |
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.
This situation is weird:
- 12 questions "Number of questions"
- Select QA Channel > Exercises > CK12 Exercises (111 questions)
- Go back to QA Channel root, click the indeterminate checkbox on QA Channel
- Now I've been allowed to select 500+ questions, and I get an error and I have to click to deselect everything
- I shouldn't have been allowed to select that many questions with my current question count
I think maybe disabling the checkbox altogether might be better than this.
Or maybe we could instead just deselect the relevant selection when there are too many questions to add -- but this might be confusing in its own right (ie, "why does it select things in some cases but deselect in others?" might not have an obvious answer.)
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.
Yes - I think I missed an edge case here and didn't ensure that checkboxes are always disabled for channels (even if we are displaying to show the descendant selector state).
// If we don't have all of the children locally, we need to fetch them | ||
const children = await ContentNodeResource.fetchCollection({ |
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.
With that said, we probably need to work on adding loading states in various places...
2024-07-01.15-05-33.mp4
@marcellamaki mentioned that she had fixed this in her PR #12374. |
yes, that will be fixed with the cards PR |
LGTM. In addition to what's already been commented above I noticed just the following which is probably not caused by the changes made here:
2024-07-03_15-37-21.mp4Also perhaps at some point the default text 'You can only select a total of 100 questions or fewer.' should be further rephrased as the distinction between the number of selected questions and the number which can actually be added is not crystal clear. |
I've added a (referenced) follow up issue for @pcenov's comment above . @nucleogenesis can you go through the code one more time and make sure all of your concerns are addressed? |
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.
The code LGTM here - my concern around the checkbox state cycle was discussed and we'll see later on if we feel the need to dig into working out how to make indeterminate go to unchecked in certain cases.
Summary
Change to behaviour for clarity:
Point for reflection: I tried to make it so that if a folder was indeterminately selected it and selecting it would exceed the max questions, it would deselect instead - this all worked, except that the KCheckbox did not properly update to the unselected state, so it made the UI more confusing. Instead, it retains its default behaviour, and instead displays the warning that too many questions are now selected.
Change to behaviour that can be reverted:
References
Fixes #12327
Reviewer guidance
Select, deselect, select all, unselect all, select some resources in a folder, and navigate to the parent. Just do all the permutations of selecting and deselecting and make sure weird edge cases don't arise.
In spite of the disabled checkboxes, it is still possible to get into a state where you have too many resources selected, but the number of paths to get there is much smaller.
Testing checklist
PR process
Reviewer checklist
yarn
andpip
)