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

Enhanced navigation reducer in Volto #5817

Merged
merged 6 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/volto/news/5772.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Enhanced navigation reducer in Volto to keep items extra-data sent from the navigation endpoint @Hrittik20
3 changes: 1 addition & 2 deletions packages/volto/src/reducers/navigation/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ const initialState = {
*/
function getRecursiveItems(items) {
return map(items, (item) => ({
title: item.title,
description: item.description,
url: flattenToAppURL(item['@id']),
...item,
davisagli marked this conversation as resolved.
Show resolved Hide resolved
...(item.items && { items: getRecursiveItems(item.items) }),
}));
}
Expand Down
6 changes: 6 additions & 0 deletions packages/volto/src/reducers/navigation/navigation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ describe('Navigation reducer', () => {
error: null,
items: [
{
'@id': 'http://localhost:8080/Plone/front-page',
title: 'Welcome to Plone!',
description:
'Congratulations! You have successfully installed Plone.',
Expand Down Expand Up @@ -91,17 +92,20 @@ describe('Navigation reducer', () => {
error: null,
items: [
{
'@id': 'http://localhost:8080/Plone/front-page',
title: 'Welcome to Plone!',
description:
'Congratulations! You have successfully installed Plone.',
url: '/front-page',
},
{
'@id': 'http://localhost:8080/Plone/folder1',
title: 'Folder1',
description: 'Folder description',
url: '/folder1',
items: [
{
'@id': 'http://localhost:8080/Plone/folderinfolder1',
title: 'FolderInFolder1',
description: 'Sub-folder description',
url: '/folderinfolder1',
Expand Down Expand Up @@ -162,6 +166,7 @@ describe('Navigation reducer (NAVIGATION)GET_CONTENT', () => {
error: null,
items: [
{
'@id': 'http://localhost:8080/Plone/front-page',
title: 'Welcome to Plone!',
description:
'Congratulations! You have successfully installed Plone.',
Expand Down Expand Up @@ -192,6 +197,7 @@ describe('Navigation reducer (NAVIGATION)GET_CONTENT', () => {
error: null,
items: [
{
'@id': 'http://localhost:8080/Plone/front-page',
title: 'Welcome to Plone!',
description:
'Congratulations! You have successfully installed Plone.',
Expand Down
Loading