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

refactor(schemas): 凡是是对象的字段(包括数组),都定义为可选 #606

Open
chuan6 opened this issue Jan 10, 2019 · 3 comments
Assignees

Comments

@chuan6
Copy link
Contributor

chuan6 commented Jan 10, 2019

提示应用代码妥善处理空值情况。

/cc @Saviio

@chuan6 chuan6 self-assigned this Jan 10, 2019
@Brooooooklyn
Copy link
Contributor

type Maybe<T> = T | null

@Brooooooklyn
Copy link
Contributor

这样也是有问题的,用的时候感叹号太多,噪音太大。失去了 optional 本身的意义。
建议你们还是和后端把 schema 定义清楚

@chuan6
Copy link
Contributor Author

chuan6 commented Jan 14, 2019

@Brooooooklyn 谢谢建议!

这里主要是为了应对 change 推送带来的非完整数据。如果客户端没有接收过某条数据的 new 推送,该条数据也没有在这个客户端的任何页面被载入过,但 change 推送过来,结果这条数据突然符合某个页面数据流对应的查询。这种情况下,某些字段不值得做 padding 去补全,那它们可能就应该是 optional 的。

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

2 participants