Skip to content

Commit 7d04046

Browse files
AWolf81Rokt33r
authored andcommitted
Fix routing for tag filtering
1 parent b9dd651 commit 7d04046

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

browser/main/Detail/MarkdownNoteDetail.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ class MarkdownNoteDetail extends React.Component {
409409
}
410410

411411
render () {
412-
const { data, location, config } = this.props
412+
const { data, dispatch, location, config } = this.props
413413
const { note, editorType } = this.state
414414
const storageKey = note.storage
415415
const folderKey = note.folder
@@ -464,6 +464,7 @@ class MarkdownNoteDetail extends React.Component {
464464
saveTagsAlphabetically={config.ui.saveTagsAlphabetically}
465465
showTagsAlphabetically={config.ui.showTagsAlphabetically}
466466
data={data}
467+
dispatch={dispatch}
467468
onChange={this.handleUpdateTag.bind(this)}
468469
coloredTags={config.coloredTags}
469470
/>

browser/main/Detail/SnippetNoteDetail.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ class SnippetNoteDetail extends React.Component {
699699
}
700700

701701
render () {
702-
const { data, config, location } = this.props
702+
const { data, dispatch, config, location } = this.props
703703
const { note } = this.state
704704

705705
const storageKey = note.storage
@@ -823,6 +823,7 @@ class SnippetNoteDetail extends React.Component {
823823
saveTagsAlphabetically={config.ui.saveTagsAlphabetically}
824824
showTagsAlphabetically={config.ui.showTagsAlphabetically}
825825
data={data}
826+
dispatch={dispatch}
826827
onChange={(e) => this.handleChange(e)}
827828
coloredTags={config.coloredTags}
828829
/>

browser/main/Detail/TagSelect.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import AwsMobileAnalyticsConfig from 'browser/main/lib/AwsMobileAnalyticsConfig'
88
import i18n from 'browser/lib/i18n'
99
import ee from 'browser/main/lib/eventEmitter'
1010
import Autosuggest from 'react-autosuggest'
11+
import { push } from 'connected-react-router'
1112

1213
class TagSelect extends React.Component {
1314
constructor (props) {
@@ -96,8 +97,11 @@ class TagSelect extends React.Component {
9697
}
9798

9899
handleTagLabelClick (tag) {
99-
const { router } = this.context
100-
router.push(`/tags/${tag}`)
100+
const { dispatch } = this.props
101+
102+
// Note: `tag` requires encoding later.
103+
// E.g. % in tag is a problem (see issue #3170) - encodeURIComponent(tag) is not working.
104+
dispatch(push(`/tags/${tag}`))
101105
}
102106

103107
handleTagRemoveButtonClick (tag) {
@@ -255,11 +259,8 @@ class TagSelect extends React.Component {
255259
}
256260
}
257261

258-
TagSelect.contextTypes = {
259-
router: PropTypes.shape({})
260-
}
261-
262262
TagSelect.propTypes = {
263+
dispatch: PropTypes.func,
263264
className: PropTypes.string,
264265
value: PropTypes.arrayOf(PropTypes.string),
265266
onChange: PropTypes.func,

0 commit comments

Comments
 (0)