mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-17 08:02:44 +00:00
Shift to history.replaceState
This commit is contained in:
@@ -77,15 +77,10 @@ const ListPage = createClass({
|
|||||||
this.setState({
|
this.setState({
|
||||||
filterString : e.target.value,
|
filterString : e.target.value,
|
||||||
});
|
});
|
||||||
|
this.updateUrl(e.target.value);
|
||||||
return;
|
return;
|
||||||
},
|
},
|
||||||
|
|
||||||
handleKeys : function(e){
|
|
||||||
if(e.key === 'Enter') {
|
|
||||||
this.updateUrl(e.target.value);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
updateUrl : function(filterTerm){
|
updateUrl : function(filterTerm){
|
||||||
const url = new URL(window.location.href);
|
const url = new URL(window.location.href);
|
||||||
const urlParams = new URLSearchParams(url.search);
|
const urlParams = new URLSearchParams(url.search);
|
||||||
@@ -93,7 +88,7 @@ const ListPage = createClass({
|
|||||||
urlParams.set('filter', filterTerm);
|
urlParams.set('filter', filterTerm);
|
||||||
if(!filterTerm) urlParams.delete('filter');
|
if(!filterTerm) urlParams.delete('filter');
|
||||||
url.search = urlParams;
|
url.search = urlParams;
|
||||||
window.location.replace(url.href);
|
window.history.replaceState(null, null, url);
|
||||||
},
|
},
|
||||||
|
|
||||||
renderFilterOption : function(){
|
renderFilterOption : function(){
|
||||||
@@ -105,8 +100,6 @@ const ListPage = createClass({
|
|||||||
autoFocus={true}
|
autoFocus={true}
|
||||||
placeholder='filter title/description'
|
placeholder='filter title/description'
|
||||||
onChange={this.handleFilterTextChange}
|
onChange={this.handleFilterTextChange}
|
||||||
onFocus={(e)=>{e.target.select();}}
|
|
||||||
onKeyDown={(e)=>{this.handleKeys(e);}}
|
|
||||||
value={this.state.filterString}
|
value={this.state.filterString}
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
|
|||||||
Reference in New Issue
Block a user