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(folder): pass rootFolderId when folderId params is null #7730

Merged
merged 3 commits into from
Jan 2, 2025

Conversation

bivanalhar
Copy link
Contributor

Problem Statement

Folder could not be created when we just entered the Materials page through clicking in Sidebar
image

Root Cause

Before PR #7626, we don't have any notions of undefined folderId, which means when we navigate to any folders inside any course, we always pass on the valid folderId as URL parameter. However, the mentioned PR introduced the notion of undefined folderId in which it's actually referring to root folder.

Even though we handled the case of when folderId is undefined by redirecting to root Folder page, the value folderId itself remains undefined and hence it's rendered as NaN when being passed on to backend for root parent Id

Resolving the Issue

When creating the New Folder, instead of merely relying on folderId, we modified that line to be using folderId if it's defined, otherwise we use currFolderInfo.id which is what's supposed to be the folderId in the first place (in case of folderId is undefined, currFolderInfo refers to root folder)

@bivanalhar bivanalhar requested a review from cysjonathan January 1, 2025 03:49
@bivanalhar bivanalhar force-pushed the bivan/fix-folder-create-error branch 2 times, most recently from 23af275 to 80c8e9b Compare January 2, 2025 05:48
@cysjonathan cysjonathan force-pushed the bivan/fix-folder-create-error branch 2 times, most recently from 4e07407 to cb9bce9 Compare January 2, 2025 07:16
update folder management spec to use root folder instead of custom top-level folder
@cysjonathan cysjonathan force-pushed the bivan/fix-folder-create-error branch from cb9bce9 to 9bc8505 Compare January 2, 2025 07:17
@cysjonathan
Copy link
Contributor

cysjonathan commented Jan 2, 2025

  • add test to check able to create new folder from root folder (to prevent regression)
  • fixed incorrect redirection to parent folder when editing current folder
  • add autofocus on folder title when dialog opens

@cysjonathan cysjonathan force-pushed the bivan/fix-folder-create-error branch from 9bc8505 to 124f3a0 Compare January 2, 2025 07:46
@cysjonathan cysjonathan enabled auto-merge (rebase) January 2, 2025 07:48
…older

previously editing current folder (e.g. update name) causes redirection to parent folder
@cysjonathan cysjonathan force-pushed the bivan/fix-folder-create-error branch from 124f3a0 to c2412e0 Compare January 2, 2025 12:51
@cysjonathan cysjonathan disabled auto-merge January 2, 2025 22:30
@cysjonathan cysjonathan merged commit 7f9a167 into master Jan 2, 2025
13 of 14 checks passed
@cysjonathan cysjonathan deleted the bivan/fix-folder-create-error branch January 2, 2025 22:32
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