standardnotes / secure-spreadsheets

Derived from https://github.com/telerik/kendo-ui-core
12 stars 14 forks source link

Save content an indented json #46

Closed kirlut closed 3 years ago

kirlut commented 3 years ago

Saving content in a single-line make it impossible to use in Android app (application either open files for 2-3 seconds or crashes). Saving content as indented solve this problem, but extension do it single-line again on change.

This should fix it.

moughxyz commented 3 years ago

We chose not to pretty-print intentionally to save on overall raw text size. I would think raw unpretty JSON would be easier to parse for a system? I don't believe this would make a difference overall. If you have any screen recordings to demo this that would be helpful.

kirlut commented 3 years ago

@mobitar I'll record one for you. How can I send it?

kirlut commented 3 years ago

@mobitar just sent you an email.

Your intention to save storage space is totally understandable. So may be change request might described from the different point of view: improve your Android app, to make it able to handle very long (dozens of thousand symbols) strings.

JaspalSuri commented 3 years ago

[....] So maybe change request might described from the different point of view: improve your Android app, to make it able to handle very long (dozens of thousand symbols) strings.

Hi @kirlut, here's at least part of the reason as to why that is:

Android operates with very tight memory conditions for our app for some reason. You will not have an issue with quantity for the large part, but only if you have some particular notes that are excessively large. If maintaining compatibility with the Android app is important, I recommend not exceeding 2MB per note (or even 1MB).

kirlut commented 3 years ago

@JaspalSuri Hi!
No, root of this particular issue is long line, not the total size of the file, Both files I use to reproduce are less then 200 kb.

@JaspalSuri @mobitar @johnny243 please see the issue I've created: https://github.com/standardnotes/mobile/issues/433

johnny243 commented 3 years ago

Hi @kirlut! Thanks for reporting this 🙂 I was able to replicate https://github.com/standardnotes/mobile/issues/433

Since this is an issue that affects not only the Secure Spreadsheets editor, perhaps we should investigate the root cause.

This PR may fix the issue, but it also increases the note size.

kirlut commented 3 years ago

@johnny243 yeah, despite as user I would be happy to have this fix right now, as engineer I tend to agree with @mobitar. Prettifying of all jsons will waste your storage space, so it's better to find and fix the root issue. Or make prettifying optional and disabled by default.