Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Solved #3455: SearchTags uses invalid vocabulary API #3743

Merged
merged 4 commits into from
Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

### Bugfix

- SearchTags uses invalid vocabulary API @silviubogan
- Fix UniversalLink storybook @tiberiuichim

### Internal
Expand Down
20 changes: 10 additions & 10 deletions src/components/theme/Search/SearchTags.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ class SearchTags extends Component {
*/
static propTypes = {
getVocabulary: PropTypes.func.isRequired,
terms: PropTypes.arrayOf(
items: PropTypes.arrayOf(
PropTypes.shape({
title: PropTypes.string,
label: PropTypes.string,
}),
).isRequired,
};
Expand All @@ -42,15 +42,15 @@ class SearchTags extends Component {
* @returns {string} Markup for the component.
*/
render() {
return this.props.terms && this.props.terms.length > 0 ? (
return this.props.items && this.props.items.length > 0 ? (
<div>
{this.props.terms.map((term) => (
{this.props.items.map((item) => (
<Link
className="ui label"
to={`/search?Subject=${term.title}`}
key={term.title}
to={`/search?Subject=${item.label}`}
key={item.label}
>
{term.title}
{item.label}
</Link>
))}
</div>
Expand All @@ -62,9 +62,9 @@ class SearchTags extends Component {

export default connect(
(state) => ({
terms:
state.vocabularies[vocabulary] && state.vocabularies[vocabulary].terms
? state.vocabularies[vocabulary].terms
items:
state.vocabularies[vocabulary] && state.vocabularies[vocabulary].items
? state.vocabularies[vocabulary].items
: [],
}),
{ getVocabulary },
Expand Down
2 changes: 1 addition & 1 deletion src/components/theme/Search/SearchTags.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('SearchTags', () => {
const store = mockStore({
vocabularies: {
'plone.app.vocabularies.Keywords': {
terms: [{ title: 'Tag 1' }, { title: 'Tag 2' }],
items: [{ label: 'Tag 1' }, { label: 'Tag 2' }],
},
},
});
Expand Down