-
Notifications
You must be signed in to change notification settings - Fork 26
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
Loading state for component #11
Comments
There is a way to do this already. Set the loading state immediately and The other way would be, when an event is forwarded to the server, give it a time out and if there is no response in that time enable the loading state until there is a response. The problem is that in the current implementation if the HTML does not change there is no response from the server. We would have to send an empty response to let the front-end know that the event was processed. What do you think? In which case do you need this loading state? When does a component should go into "loading" state? |
Hi Eddy, thanks for replying.
I solved the case where computation are very long and delegated to celery... In that case I update a model that store the progression of the calculation and the frontend explicitly update with a progress bar. A loading state would be useful when the rendering takes a little longer than usual... ~1-5 seconds. Let me think more about this and if i'm stuck I will come back to ask. |
@edelvalle Hi Edy, I was thinking again about this loading state (I made a small modification to reactor.coffee to handle it). Do you see a way to do that using the hooks that you mention here: https://github.com/edelvalle/reactor#js-hooks ? I think a missing hook would be: With PS: I started putting everything we did around reactor in shape to publish soon: jinja integration, a simplistic "vuex" router, a store (easy sibling components communication), permissions around components, a chartjs integration, an upload component... each one in its own app. |
Hi Eddy, <div {{ header() }} >
{% if loading %}
<h1>Loading...</h1>
{% else %}
<button @click.inlinejs="reactor.send(this, 'set_loading', {}); reactor.send(this, 'long_task')">Run long task</button>
{% endif %}
</div> The Cons:
Pros:
An alternative could be:
What do you think @edelvalle ? |
Hi Eddy,
I just pulled your new version. Awesome !
I love the @ syntax for event binding.
Do you think it would be hard to add a "loading" state on components ?
Where should I start to implement this ?
Thanks
The text was updated successfully, but these errors were encountered: