Skip to content

keep the input situation when validation is failed #3

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aki2o
Copy link
Collaborator

@aki2o aki2o commented Dec 21, 2014

現状だと、wmvc:validate-fieldsでvalidationが失敗した時、
modelを更新しないでwmvc:reload-bufferしているので、入力内容が消えてしまいます。

@kiwanami
Copy link
Owner

あら。手元で試すと、保持されているのですが、環境の違いかな。

(wmvc:bind-from-widgets ctx) で、ctx中身のmodelも変更されるので、代入しなくてもいいかなと思っています。たぶん。

↑これは意図した動作ですが、確かに副作用的な動きは関数的でなくて気持ち悪いかも知れません。
他のOOP的言語のMVCなフレームワークのように、モデルオブジェクトを変更すると、その参照を見ている他のオブジェクト(ビューとか)が、モデルにすぐにアクセスできるといいかなと思っただけなので、ctx(やmodelも)をイミュータブルにして、変更後をまるごと受け取るというふうにしてもいいかも知れません。

@aki2o
Copy link
Collaborator Author

aki2o commented Dec 22, 2014

#4 の変更によって起きていたことに気づいてなかったです。。すいません。
やっぱり意図的にそうしてたんですね。
僕は理解が浅くて、alistを今までオブジェクト的に見れていなかったので、
ハマってしまいましたが、他のMVCフレームワークを意識した設計ということなら、
このままで良いかもですね。

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

Successfully merging this pull request may close these issues.

2 participants