-
Notifications
You must be signed in to change notification settings - Fork 43
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
Optimistic updates #64
Comments
It also can help solve the issue with optimistic updates. optimistic_before :save_data do
set_prop "#name", value: "...processing...", disabled: true
end
def save_data(socket, _sender) do
set_prop socket, "#name", value: Database.get_name()
end
optimistic_after :save_data do
set_prop "#name", disabled: false
end The code in |
Could you explain what "optimistic update" is? I'm not sure what do you mean by that and what it has to do with ElixirScript and I have a feeling that there are two different features here. Also, adding ElixirScript could create a big source of confusion when interacting between a regular Elixir and ElixirScript: defmodule TodoCommander do
use Drab.Commander
...
def add_new_item(socket, title) do
new_item = %Todo.Todo{title: tile, completed: false, id: UUID.new()}
exec socket do
Todo.List.add_todo(new_item)
end
end
end This would not work, because And all of that assuming the compilation problem of those var _result = Todo.List.add_todo(var0) So the Drab<->ElixirScript combo would need to somehow know, which modules compiled to JS were already loaded by the browser. |
Optimistic update is an action done on the client side, before the server respond, to make a latency compensation which makes the user experience better. See the discussion started here https://elixirforum.com/t/drab-phoenix-library-for-server-side-dom-access/3277/283?u=grych Optimistic updates are not in the scope of 1.0 anymore, I'll leave it for a future. As now, I am thinking about just providing an API to put JS as a string. We will see. About ElixirScript, this is a rather an idea and a discussion, than the real implementation plan. And it is not even possible yet.
If the ES would be implemented, it must be solved somehow. |
In analogy to
execjs
, we could integrate ElixirScript into Drab and write the whole stuff in Elixir only.The text was updated successfully, but these errors were encountered: