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

[bug] Newly typed text in long paragraphs sometimes is displayed below influx section for a few seconds for large notes (Uncaught range error?) #40

Closed
danieltomasz opened this issue Oct 23, 2022 · 20 comments
Labels
bug Something isn't working

Comments

@danieltomasz
Copy link

danieltomasz commented Oct 23, 2022

It happens with live text and and live text turned off in the Influx, Obsidian is in Live Preview mode.

When I have a note with large number of linked mentions (lets say 20, the are not visible without scrolling) I sometimes observe the following behaviour:

  • when I have the large paragraph to type (in bullet points), the text I type sometimes appear below the Influx section for a few seconds and then the cursor came back to the "proper" section of the note
  • the text is in its proper place, dont disseappers, but it is just displayed for a few seconds as it were below the Influx section
  • I didnt observed this in a notes with small amount of linked mentions
  • even if I collapse the references, after a few typed words, the linked mentions un-collapse and the type words appears again on the bottom of the pane, below the Influx linked mentions, and then the typed text slowly (sometimes letter by letter) appear again in the line when I typed it
  • when this is happening I saw this in the developer console, not sure if related
Uncaught RangeError: Position 396 is out of range for changeset of length 395
    at t.e.mapPos (app.js:1:270074)
    at e.map (app.js:1:302081)
    at e.update [as updateF] (plugin:influx:23527:15)
    at Object.update (app.js:1:283426)
    at e.computeSlot (app.js:1:294218)
    at Fn (app.js:1:287369)
    at new e (app.js:1:293244)
    at e.applyTransaction (app.js:1:294160)
    at e.get (app.js:1:289373)
    at e.update (app.js:1:434795)

I will try to make a gif to make it better to see what is happening.
I also try to turn off other plugins, to see if this persist
MacOS 13, Obisidian, 1.02, Influx 2.0.7

@danieltomasz danieltomasz changed the title [bug] Newly typed text in long paragraphs sometimes is displayed below influx section for a few seconds for large notes [bug] Newly typed text in long paragraphs sometimes is displayed below influx section for a few seconds for large notes (Uncaught range error?) Oct 23, 2022
@danieltomasz
Copy link
Author

I recorded the screen, with recoding the behaviour is even worse (so maybe this is about computational resources - BTW I am on M1 macbook pro, so this shouldnt be a problem)
https://www.loom.com/share/6c5189fbc5424592b1a829e7d48f042a

@danieltomasz
Copy link
Author

The one thing that come to my mind that this beta plugin I started using could mess up with the Influx function calls and internal states https://github.com/TfTHacker/obsidian42-strange-new-worlds
(But probably not)

@jensmtg
Copy link
Owner

jensmtg commented Oct 23, 2022

Thanks for an extensive bug report! This is #8 and #29 I suspect, but will check it out when I get a chance.

@danieltomasz
Copy link
Author

danieltomasz commented Oct 23, 2022

Reading the issues I think I found the cause, it might be Minimal with wide dataview view enabled

  • when I switched to vanilla Obsidian the jumping stopped, the influx view still disappears stops working for a few miliseconds, when I type really fast but there coursor and the text doesn't move, altought the influx view is still "jumpy" and flashy, as it turning on and off for miliseconds (the live update is off)
    https://www.loom.com/share/b792bf10c6cc42c4b85355ab02dccab9
  • so i think there are 2 bugs
  • influx is shortlyy stopping displaying and is redrawing everything when I typed fast
  • when influx redraw it interfers with plugins that expand dataview table like minimal or this one https://github.com/efemkay/obsidian-modular-css-layout
  • when there any many linked notes it just take much longer to redraw and this is more visible to the eye when in case of only a few; jusing vanilla obsidian make this redrawing faster but it still shows me the expanded linked notes, altough the text stays in the body of the note
  • this will be visible only when there is 10-20 linked notes with quite long text on them, in case of smaller number of links the problem occurs but the performance is better

(BTW I just found in the video another bug related to text in bullet points but this is not influx related :P )
https://www.loom.com/share/b792bf10c6cc42c4b85355ab02dccab9

@danieltomasz
Copy link
Author

Maybe a way to investigate the issue (MVE);

  • Typing really fast un-collapse all linked mentions, forcing collapsing to be persistent might be a workaround (until uncollapsing) , the collapsed view is still jumping but the jumping is much less invasive

@jensmtg jensmtg added the bug Something isn't working label Oct 24, 2022
@mediapathic
Copy link

Just to add a couple of data points here:

I am also seeing this behavior, but it does not require a large number of linked notes for me; I see it on notes that have only one or two. I'm using the default theme. I don't get the "text appears under links" consistently, but even when that doesn't happen I still have the list of links disappearing and reappearing while I type (and, with typewriter scroll turned on, this causes the entire document to leap up and down, which is extra annoying).

@danieltomasz
Copy link
Author

danieltomasz commented Oct 24, 2022

The other way to make this visible is to enable the vanilla backlinks to actually see disappearing and appearing of the plugin (obsidian backlinks go up and down in the moment the influx is not rendered); as I think, the error happens in small number of notes, but it might be harder to catch by eye as the only a few of backlinks are rendered much faster (it will also depends from how fast the computer is)

@jensmtg
Copy link
Owner

jensmtg commented Oct 24, 2022

It's a bug related to how codemirror handles widget extensions.
As such, I can't fix this directly, but I have an idea for a work-around that I think will essentially solve the problem. I'll probably get a chance to explore it sometime in the coming month.

@emory
Copy link

emory commented Nov 3, 2022

i wish i would have checked in here first because i'm seeing the same behavior and it sometimes stomps on in-line edits while i'm writing a note! i thought it was related to tag autocomplete or something but it drives me bonkers because it even re-arranges words while i'm writing sometimes.

a brief demonstration from my workstation (12-core i7 MBP touchbar with 32GB of memory) https://www.dropbox.com/s/059vzx7fpa2pr2o/CleanShot%202022-11-03%20at%2016.44.16.mp4?dl=0

this happens in every note i type in; daily or meeting notes, content maps — the vault from the example above has 2700 markdown documents and 9200 files total, most of my vaults are also git repositories though and the .git directory on this particular vault has 3000 files in it. i have configured Influx to operate (include) in my daily notes tree, my zettelkasten tree, my PARA Projects/Areas/Resources/Archive directories.

RedactedVault % find . -type f -name "*md" | wc -l
    2752
RedactedVault% find . -type f | wc -l
    9286

this workstation doesn't run very smoothly but i have IO and cpu time to spare. only thing that may be unusual is that i routinely have a lot of open files. my obsidian vaults are also indexed by DEVONthink. Open and Save dialog boxes can hang for up to minute for some reason that i've never been able to remediate.

@zcysxy
Copy link

zcysxy commented Nov 22, 2022

I am also experiencing this problem. Another issue is that when I delete letters, the window jumps occasionally.

https://www.loom.com/share/babe4f480831460eaf0f8175f7ee7d45

@cathywu
Copy link

cathywu commented Nov 27, 2022

I'm also experiencing this issue, as well as what's mentioned by @zcysxy.

@dummylabs
Copy link

Have the same issue on my macbook pro.

@farid56x
Copy link

I have the exact same issue.

@pawel-ilnicki
Copy link

pawel-ilnicki commented Jan 9, 2023

@jensmtg any success on the workaround you mentioned by any chance?

@pawel-ilnicki
Copy link

I encourage people irritated by this bug to include an additional line at the end of all your most-used templates:

<% tp.file.cursor(1) %>

%% This line stops influx from misbehaving %%

What this achieves is prevents the bug from occurring by having another line below where you type. file.cursor() moves your cursor up after pasting the template, so you don't have to do it manually.

@jensmtg
Copy link
Owner

jensmtg commented Jan 9, 2023

@pawel-ilnicki Interesting work-around! No, I've not had the chance to develop this plugin further for a long time, unfortunately. (Life eats you up!) Hopefully I'll get a chance to do so before summer.

@farid56x
Copy link

farid56x commented Jan 9, 2023

I encourage people irritated by this bug to include an additional line at the end of all your most-used templates:

<% tp.file.cursor(1) %>

%% This line stops influx from misbehaving %%

What this achieves is prevents the bug from occurring by having another line below where you type. file.cursor() moves your cursor up after pasting the template, so you don't have to do it manually.

it works, big thanks! I still have some performance issues with big files, but I can handle that for now.

@alranel
Copy link

alranel commented Jan 13, 2023

I'm experiening this as well and sadly it's a showstopper which is a pity because I love this plugin :)
@jensmtg, any chance you can elaborate on the workaround you have in mind as mentioned above? That way someone might try to implement it.

@jensmtg
Copy link
Owner

jensmtg commented Feb 3, 2023

The workaround that hides influx while typing is in place with the latest version, as an optional but default setting, so this issue should be solved now - to the extent that it can be without access to obsidian internals.

@zcysxy
Copy link

zcysxy commented Feb 17, 2023

The workaround works great! However, when influx disappears, the editor view also moves.

Screen.Recording.2023-02-17.at.02.43.55.mov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

10 participants