-
Notifications
You must be signed in to change notification settings - Fork 81
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
refactor: split up library context #1539
Merged
ChrisChV
merged 13 commits into
openedx:master
from
open-craft:rpenido/fal-3983-split-up-library-context
Dec 12, 2024
+764
−656
Merged
Changes from 8 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
175ea87
refactor: create ComponentPickerContext
rpenido 0f451a6
refactor: move context files
rpenido 1819bc5
refactor: create SidebarContext
rpenido b2f6f4b
fix: collectionId url consistency
rpenido ad6a758
refactor: remove LibraryTeamModal from LibraryLayout and LibraryContext
rpenido 36ccc7c
fix: format
rpenido 27452f7
test: fix tests
rpenido 8f89646
test: improve coverage
rpenido a4b53a3
Merge branch 'master' into rpenido/fal-3983-split-up-library-context
rpenido 829cb5a
fix: add context defaults
rpenido c805858
revert: revert LibraryContext defaults
rpenido eb56bf3
test: fix typo
rpenido 9b28bb1
test: remove SidebarProvider
rpenido File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,9 +6,9 @@ import { | |
} from 'react-router-dom'; | ||
|
||
import LibraryAuthoringPage from './LibraryAuthoringPage'; | ||
import { LibraryProvider } from './common/context'; | ||
import { LibraryProvider } from './common/context/LibraryContext'; | ||
import { SidebarProvider } from './common/context/SidebarContext'; | ||
import { CreateCollectionModal } from './create-collection'; | ||
import { LibraryTeamModal } from './library-team'; | ||
import LibraryCollectionPage from './collections/LibraryCollectionPage'; | ||
import { ComponentPicker } from './component-picker'; | ||
import { ComponentEditorModal } from './components/ComponentEditorModal'; | ||
|
@@ -27,6 +27,8 @@ const LibraryLayout = () => { | |
|
||
return ( | ||
<LibraryProvider | ||
/** We need to pass the collectionId as key to the LibraryProvider to force a re-render | ||
* when we navigate to a collection page. */ | ||
key={collectionId} | ||
libraryId={libraryId} | ||
collectionId={collectionId} | ||
|
@@ -36,19 +38,20 @@ const LibraryLayout = () => { | |
* Sidebar > AddContentContainer > ComponentPicker */ | ||
componentPicker={ComponentPicker} | ||
> | ||
<Routes> | ||
<Route | ||
path="collection/:collectionId" | ||
element={<LibraryCollectionPage />} | ||
/> | ||
<Route | ||
path="*" | ||
element={<LibraryAuthoringPage />} | ||
/> | ||
</Routes> | ||
<CreateCollectionModal /> | ||
<ComponentEditorModal /> | ||
<LibraryTeamModal /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Once the |
||
<SidebarProvider> | ||
<Routes> | ||
<Route | ||
path="collection/:collectionId" | ||
element={<LibraryCollectionPage />} | ||
/> | ||
<Route | ||
path="*" | ||
element={<LibraryAuthoringPage />} | ||
/> | ||
</Routes> | ||
<CreateCollectionModal /> | ||
<ComponentEditorModal /> | ||
</SidebarProvider> | ||
</LibraryProvider> | ||
); | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
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.
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.
@rpenido Now that we have default values for sidebar context, the providers can be removed from tests that don't actually use it. For example, this one works without
SidebarProvider
. Similarly we can simplify other tests, which was the reason for adding default values.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.
Thanks @navinkarkera! Fixed!