Skip to content
This repository has been archived by the owner on Sep 17, 2019. It is now read-only.

Included source blocks are reloaded on each keystroke #474

Open
gquintana opened this issue Jan 19, 2017 · 4 comments
Open

Included source blocks are reloaded on each keystroke #474

gquintana opened this issue Jan 19, 2017 · 4 comments
Labels

Comments

@gquintana
Copy link

The scenario:

  1. Open the browser debugger to watch the network traffic
  2. Edit an existing post like the one below
  3. Try to add some text in the post editor
  4. On each keystroke, the awesome.go file reloaded with an Ajax request and interrupts keyboard input
= Test

:source_dir: ../sources

Look how awesome is my code:

[source,go]
----
include::{source_dir}/awesome.go[tags=main]
----
@gquintana gquintana changed the title Included source blocks are reload on each keystroke Included source blocks are reloaded on each keystroke Jan 25, 2017
@jaredmorgs jaredmorgs added the bug label Mar 1, 2017
@jaredmorgs
Copy link
Contributor

Is this happening with Live Preview activated, or just with the raw AsciiDoc view @gquintana ?

I know that the Live Preview would trigger a view refresh as asciidoctor.js re-rendered the file. But I wouldn't expect it to re-trigger the render when the live preview was hidden.

@gquintana
Copy link
Author

@jaredmorgs No includes are reloaded even if preview panel is hidden. Yet, I found a workaround setting config.meta.delay to 10s or more: it slows down to a refresh every 10s, this makes online post editor usable again.
https://github.com/HubPress/hubpress.io/blob/development/src/hubpress/scripts/components/Post.react.js#L64

@jaredmorgs
Copy link
Contributor

I'd say that @anthonny needs to disconnect the editor pane refresh from the live preview refresh.

Also, I'd recommend that you update to 0.7.0 and see if the problem persists. Could you confirm here once you've updated if the include macros still cause the editor pane lag.

Thanks for your help with testing this for us. 👍

@anthonny
Copy link
Member

anthonny commented Mar 2, 2017

This a bit more complex that just a refresh.

I explain:

Each time you change the content of your post, a conversion in HTML is made by asciidoctor and the result is save in the pouchdb database.
This content is use when you publish your post.

If you set the delay to 10 second, the editor will wait 10 second before generate the HTML content.
If you close the editor at 9sec, the HTML will not be generated and not save so you will lose your content.

IMHO the best thing to do is to cache the ajax call for X second

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants