fix(folder): pass rootFolderId when folderId params is null #7730
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem Statement
Folder could not be created when we just entered the
![image](https://private-user-images.githubusercontent.com/16359075/399538387-ee8f67ef-e630-4576-8f33-512804314eee.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5Mzk0NjcsIm5iZiI6MTczODkzOTE2NywicGF0aCI6Ii8xNjM1OTA3NS8zOTk1MzgzODctZWU4ZjY3ZWYtZTYzMC00NTc2LThmMzMtNTEyODA0MzE0ZWVlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA3VDE0MzkyN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWM3OGZkMGRjNDc0NTk0ZDFkOWFkN2M2NGRkODBjYTE1MjgzNjBhMWNmNGRiZDUzZTc2YTE3MDk1OTVlYmJmYjImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.-O7PZ6HeydQQjUdirtuYBNCRbFfMdy9TIximCiGK52Y)
Materials
page through clicking in SidebarRoot 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 validfolderId
as URL parameter. However, the mentioned PR introduced the notion ofundefined
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 valuefolderId
itself remainsundefined
and hence it's rendered asNaN
when being passed on to backend for root parent IdResolving the Issue
When creating the New Folder, instead of merely relying on
folderId
, we modified that line to be usingfolderId
if it's defined, otherwise we usecurrFolderInfo.id
which is what's supposed to be thefolderId
in the first place (in case offolderId
is undefined,currFolderInfo
refers to root folder)