leetcode-opensource / ayanami Goto Github PK
View Code? Open in Web Editor NEW🍭 A better way to react with state
License: MIT License
🍭 A better way to react with state
License: MIT License
Currently, setStateAction is used in Effect to update state, which is actually the responsibility of Reducer. Effect should only perform side-effects and dispatch actions. So please remove this API.
React native is compatible with hooks.
4.14.126
to 4.14.127
.This version is covered by your current version range and after updating it in your project the build failed.
@types/lodash is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
2.1.0
to 2.2.0
.This version is covered by your current version range and after updating it in your project the build failed.
@typescript-eslint/eslint-plugin is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
The new version differs by 10 commits.
d8767f0
chore: publish v2.2.0
f1059d8
fix(eslint-plugin): [efrt] allowExpressions - check functions in class field properties (#952)
e011e90
fix(eslint-plugin): [prefer-readonly] add handling for destructuring assignments
e01dc5f
feat(eslint-plugin): add brace-style [extension] (#810)
e9fcf70
docs: Update supported TypeScript version range (#951)
6a5c77c
docs(eslint-plugin): fix formatting typo
736a074
docs(eslint-plugin): explicitly document mixed codebase usage fo… (#939)
ccb98d8
fix(eslint-plugin): [expl-member-a11y] fix parameter properties (#912)
0f63e3f
chore: support typescript 3.6 (#916)
9fce08d
chore(README): update notes regarding releases (#936)
See the full diff
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
solution A: using decorators to distinguish singleton
or non-singleton
@Singleton()
class SomeThing extends Ayanami {}
@Transient()
class AnotherThing extends Ayanami {}
solution B: export another class for non-singleton usage
class SomeThing extends NonSingletonAyanami {}
现在ayanami的类不支持使用getter,能否通过computed装饰器增加对getter的支持?
使用起来类似这样:
@computed get totalPrice() { const good = goodList[this.index] return good.number * good.price; }
something like Ayanami.connect(SomeComponent)
2.3.0
to 2.3.1
.This version is covered by your current version range and after updating it in your project the build failed.
@typescript-eslint/parser is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
The new version differs by 6 commits.
6279c5b
chore: publish v2.3.1
ca8ac79
docs(eslint-plugin): add missing ROADMAP link (#998)
dfb4fd6
docs(typescript-estree): correct typo (#995)
19abbe0
fix(typescript-estree): parsing error for await in non-async func (#988)
c3c8b86
fix(eslint-plugin): [cons-type-assns] handle namespaced types (#975)
e348cb2
fix(eslint-plugin): [pfa] Allow async getter/setter in classes (#980)
See the full diff
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
https://github.com/zalmoxisus/redux-devtools-extension/blob/master/docs/API/Methods.md
[问题描述]
ayanami constructor里面注入value会导致依赖报错
[复现步骤]
[版本]
[email protected]之后的版本都能复现
[codesandbox]
https://codesandbox.io/s/ayanamiminimal-example-u1cto
[问题源码]
ayanami/src/core/scope/utils.ts
Line 40 in c601a84
Using immer in complicated state is much more concise than POJ.
For example:
interface State: {
ui: {
comments: { [index: string]: Array<Comment> }
}
}
@ImmerReducer()
addComment(state: State, { payload }: Action<{ articleId: string, comment: Comment }>) {
state.ui.comments[payload.articleId].push(payload.comment)
}
vs
@Reducer()
addComment(state: State, { payload }: Action<{ articleId: string, comment: Comment }>) {
const comments = state.ui.comments.get(payload.article)
return { ...state, ui: { ...state.ui, comments: { ...state.ui.comments, [payload.articleId]: [...comments, payload.comment] } } }
}
1.11.0
to 1.12.0
.This version is covered by your current version range and after updating it in your project the build failed.
@typescript-eslint/eslint-plugin is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
const;
(#633) (430d628), closes #441async
identifier token typed as Keyword
(#681) (6de19d3)The new version differs by 13 commits.
cd96c38
chore: publish v1.12.0
b30e78d
chore(deps): bump lodash.template from 4.4.0 to 4.5.0 (#693)
e0aeb18
feat(eslint-plugin): [explicit-function-return-type] add handling for usage as arguments (#680)
6de19d3
fix(typescript-estree): fix async
identifier token typed as Keyword
(#681)
af70a59
feat(eslint-plugin): Add rule no-reference-import (#625)
34e7d1e
feat(eslint-plugin): add rule strict-boolean-expressions (#579)
44677b4
docs(eslint-plugin): format array-type docs
44b099d
docs(eslint-plugin): Expand docs for array-type (#634)
b83ff5a
docs: add link to eslint support in TS repo (#650)
430d628
fix(eslint-plugin): handle const;
(#633)
e325b72
feat(eslint-plugin): [ban-types] Support namespaced type (#616)
606fc70
feat(eslint-plugin): [no-explicit-any] Add an optional fixer (#609)
76b89a5
feat(eslint-plugin): added new rule prefer-readonly (#555)
See the full diff
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
if we invoke else service method suck as this.getActions()
inside the effectActions[actionName]
function in sync way, it will cause an error:
InternalError: "too much recursion"
the effect can be:
@Effect()
fetchInfo(url$: Observable<string>):Observable<EffectAction> {
return url$.pipe(
switchMap(url => from(client.get(url))),
mergeMap(data => of(this.getActions().setData(data), this.getActions().setLoading(false))),
startWith(this.getActions().setLoading(true)),
)
}
the effect init function is :
Line 196 in b7b644b
because the startWith
is sync, so this.getActions()
will request the ikari
instance, but the ikari instance is not fully constructed at that time. so it will invoke the create function again and agian...
16.8.13
to 16.8.14
.This version is covered by your current version range and after updating it in your project the build failed.
@types/react is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
I tried to use ayanami in RN but failed. Can ayanami support rn or is there any plan to adapt rn...
Since Ayanami
is a singleton, the state and effect actions are shared for each test instance which is a bad practice for testing.
现在有比较多的场景都需要effects执行完毕的回调,比如loading,编辑弹窗完成后异步提交结束后关闭弹窗,但是现在的异步actions执行的结果的undefined,无法获取执行完毕的回调,需要通过设置额外的state来标示,然后通过判断state的变化来执行对应的操作,每个类都需要写一遍,感觉有点复杂
16.8.16
to 16.8.17
.This version is covered by your current version range and after updating it in your project the build failed.
@types/react is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
When I trying to update state in render just like using getDerivedStateFromProps, the initial Ayanami state cannot be ignored. This might not be a problem, but the behavior is different with just storing state in component.
The example:
state in ayanami: https://codesandbox.io/s/ayanamiminimal-example-zw3fi?fontsize=14
state in component: https://codesandbox.io/s/test-getderivedstatefromprops-lricw?fontsize=14
RxJS is great as process management, but sometimes our Effect dosen't need too much async management ability. So I really want a simpler way to provide async management ability.
@GeneratorEffect()
async fetchUserInfo(payload: T) {
const response = await client.query({ ... })
try {
yield this.getActions().setUserInfo(assertSuccess(response))
} catch (e) {
yield this.getActions().getUserInfoFailed(e)
}
}
4.14.129
to 4.14.130
.This version is covered by your current version range and after updating it in your project the build failed.
@types/lodash is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
2.6.0
to 2.6.1
.This version is covered by your current version range and after updating it in your project the build failed.
@typescript-eslint/parser is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
The new version differs by 4 commits.
643d6d6
chore: publish v2.6.1
e54998d
fix(typescript-estree): improve comment parsing code (#1120)
366518f
fix(typescript-estree): fix filename handling for vue JSX + markdown (#1127)
17c956e
fix(typescript-estree): don't use typescript's synthetic default (#1156)
See the full diff
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
16.8.10
to 16.8.11
.This version is covered by your current version range and after updating it in your project the build failed.
@types/react is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
目前项目中classComponent比较多,用不了useAyanami hooks,connect方法能提供第三个参数支持scope,跟useAyanami方法保持一致么?
Current we have to test action in a React way, for example:
testRenderer.root.findByProps({ id: action }).props.onClick()
which is no efficient. We need a better way to test.
如题,是不是应该改成loadsh.get或者lodash/get?
First, we should align behavior with redux reducer, or we need change the name Reducer
to something else.
The second, in most case, action & payload is optional, there are too many codes in Modules like :
setLoading(_: void, state: State)
too ugly.
新版本里useAyanami不支持传入scope了,是基于什么考虑去掉了这个特性呢?后续有没有替代方案支持组件间的数据隔离
4.14.135
to 4.14.136
.This version is covered by your current version range and after updating it in your project the build failed.
@types/lodash is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
I want to store some state (for example i18n info) into ayanami modules so that I can get feedback immediately I change the language;
However, I also need to use current i18n info to do sth for example toast some messages. But I am not sure is there a way to access the info stored in the ayanami modules outside React Components just like a getStores function in redux?
4.17.1
to 4.17.2
.This version is covered by your current version range and after updating it in your project the build failed.
@types/express is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
1.9.0
to 1.10.0
.This version is covered by your current version range and after updating it in your project the build failed.
@typescript-eslint/eslint-plugin is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
use
means hooks already. useHooks
looks too verbose.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.