Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

【bug反馈】westore.update 没有定义callback #143

Closed
nanhupatar opened this issue May 11, 2023 · 9 comments
Closed

【bug反馈】westore.update 没有定义callback #143

nanhupatar opened this issue May 11, 2023 · 9 comments

Comments

@nanhupatar
Copy link
Contributor

export function update(view, callback) {
  const patch = diffData(view.data, view._westorePrevData)
  view.setData(patch, callback)
  view._westorePrevData = clone(view.data)
}


export class Store {
  constructor() {
    this.views = {}
    this._westoreViewId = 0
  }

  bind(keyOrView, view) {
    if (arguments.length === 1) {
      this.data = keyOrView.data
      this.views[this._westoreViewId++] = keyOrView
    } else {
      //设置回 view 的 data,不然引用地址 错误
      this.data = view.data
      this.views[keyOrView] = view
    }
  }

  update(viewKey) {
    if (arguments.length === 1) {
      update(this.views[viewKey])
    } else {
      for (const key in this.views) {
        update(this.views[key])
      }
    }
  }
}

暴露的类没有定义callback,

@nanhupatar
Copy link
Contributor Author

@dntzhang

@nanhupatar nanhupatar changed the title westore.update 没有定义callback 【bug反馈】westore.update 没有定义callback May 11, 2023
@nanhupatar
Copy link
Contributor Author

真的很重要

@nanhupatar
Copy link
Contributor Author

@dntzhang

@nanhupatar
Copy link
Contributor Author

没人处理这个bug吗

@nanhupatar
Copy link
Contributor Author

@YunYouJun

@YunYouJun
Copy link
Contributor

你说的 callback 是这里吗?你可以直接创建一个 PR。

  update(viewKey) {
    if (arguments.length === 1) {
      update(this.views[viewKey])
    } else {
      for (const key in this.views) {
        update(this.views[key])
      }
    }
  }

@nanhupatar
Copy link
Contributor Author

你说的 callback 是这里吗?你可以直接创建一个 PR。

  update(viewKey) {
    if (arguments.length === 1) {
      update(this.views[viewKey])
    } else {
      for (const key in this.views) {
        update(this.views[key])
      }
    }
  }

是的,我不太会使用pr。如果您可以帮忙看一下,非常感谢

@nanhupatar
Copy link
Contributor Author

你说的 callback 是这里吗?你可以直接创建一个 PR。

  update(viewKey) {
    if (arguments.length === 1) {
      update(this.views[viewKey])
    } else {
      for (const key in this.views) {
        update(this.views[key])
      }
    }
  }

是的,我不太会使用pr。如果您可以帮忙看一下,非常感谢

提了pr ,无法联系到仓库管理员进行合并,如果您有联系方式能帮忙push一下吗

@dntzhang
Copy link
Collaborator

好了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants