npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

oo-graphql-mobx

v1.2.0

Published

Object oriented graphql client integrate with mobx.

Downloads

24

Readme

问题 - 继承GraphqlStore的store类,成员变量未初始化

  • 问题表现
//this.allList is undefined
return this.allList.find(...);
  • 解决方法:修改.babelrclegacyloose两个配置必须加上
{
  "presets": [
    "@babel/env"
  ],
  "plugins": [
    ["@babel/plugin-proposal-decorators", { "legacy": true }],
    ["@babel/plugin-proposal-class-properties", { "loose" : true }]
  ]
}

优化 - 使用Object.assign

{
  "presets": [],
  "plugins": [
    ["@babel/plugin-proposal-object-rest-spread", { "loose": true, "useBuiltIns": false }]
  ]
}

转为typescript,.babelrc备份

{
  "presets": [
    "@babel/env"
  ],
  "plugins": [
    ["@babel/plugin-proposal-decorators", { "legacy": true }],
    ["@babel/plugin-proposal-class-properties", { "loose" : true }],
    ["@babel/plugin-proposal-object-rest-spread", { "loose": true, "useBuiltIns": false }]
  ]
}

mobx在taro中的限制

  • 只有在react控件的render中将store对应的属性保存到本地变量,该属性修改时,mobx才会通知observer控件

  • 以上的原理是:render中的本地变量,taro会处理到state

  • 下面代码中:目前的taro-mobx只会监控currentItem, message,不会监控这些属性下级的变化

    const {manager: {currentItem, message}} = this.props;
    • 无监控:message.text='xxx'
    • 有监控:message={...}
  • 下面代码中:没有设置currentItem本地变量,mobx不会更新视图

    <View>{this.props.reserve.currentItem.name}</View>