chore: replace static null stateKey with dynamic buildStateKey method in RantFeed
This commit is contained in:
parent
f76c44a7e6
commit
87a5d8bb68
@ -21,13 +21,24 @@ class RantFeed extends BaseComponent {
|
||||
this.sort = this.getAttr('sort') || 'recent';
|
||||
this.feedType = this.getAttr('feed-type') || 'rants';
|
||||
this.blockChangeHandler = () => this.render();
|
||||
this.stateKey = null;
|
||||
this.stateKey = this.buildStateKey();
|
||||
this.pendingRestore = null;
|
||||
|
||||
this.render();
|
||||
this.bindEvents();
|
||||
}
|
||||
|
||||
buildStateKey() {
|
||||
const feedType = this.getAttr('feed-type') || 'rants';
|
||||
if (feedType === 'search') {
|
||||
return null;
|
||||
}
|
||||
if (feedType === 'rants') {
|
||||
return 'feed_state_home';
|
||||
}
|
||||
return 'feed_state_' + feedType;
|
||||
}
|
||||
|
||||
setStateKey(key) {
|
||||
this.stateKey = key;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user