fixed cookie reactivity

This commit is contained in:
smilerz
2021-08-25 16:43:52 -05:00
parent b74fdb3825
commit aa2d0eafb1
3 changed files with 16 additions and 14 deletions

View File

@ -322,18 +322,20 @@ export default {
mounted() {
this.$nextTick(function () {
if (this.$cookies.isKey(SETTINGS_COOKIE_NAME)) {
let cookie_val = this.$cookies.get(SETTINGS_COOKIE_NAME)
for (let i of Object.keys(cookie_val)) {
this.$set(this.settings, i, cookie_val[i])
}
//TODO i have no idea why the above code does not suffice to update the
//TODO pagination UI element as $set should update all values reactively but it does not
setTimeout(function () {
this.$set(this.settings, 'pagination_page', 0)
}.bind(this), 50)
setTimeout(function () {
this.$set(this.settings, 'pagination_page', cookie_val['pagination_page'])
}.bind(this), 51)
this.settings = Object.assign({}, this.settings, this.$cookies.get(SETTINGS_COOKIE_NAME))
// let cookie_val = this.$cookies.get(SETTINGS_COOKIE_NAME)
// for (let i of Object.keys(cookie_val)) {
// this.$set(this.settings, i, cookie_val[i])
// }
// //TODO i have no idea why the above code does not suffice to update the
// //TODO pagination UI element as $set should update all values reactively but it does not
// setTimeout(function () {
// this.$set(this.settings, 'pagination_page', 0)
// }.bind(this), 50)
// setTimeout(function () {
// this.$set(this.settings, 'pagination_page', cookie_val['pagination_page'])
// }.bind(this), 51)
}