kevboh / longform

A plugin for Obsidian that helps you write and edit novels, screenplays, and other long projects.
Other
610 stars 30 forks source link

Failed to read properties of null #262

Closed Akmedrah closed 1 week ago

Akmedrah commented 1 week ago

Versions Longform version: 2.0.7 Obsidian version: 1.6.3 OS [e.g. macOS, Windows, iOS, Android]: Windows Theme: AnuPpuccin

Other plugins that you think might be relevant here: PLUGIN : CHANCE OF ISSUE Better Export PDF : 1/5 Dataview : 3/5 Editing Toolbar : 1/5 Force note view mode : 4/5 Homepage : 2/5 Linter : 5/5 Style Settings : 1/5 Tag Wrangler : 5/5 Templater : 5/5 Text Format : 4/5 Typewriter Mode : 2/5 Typewriter Scroll : 2/5 Various Compliments : 4/5 Writing Goals : 3/5

Describe the bug After creating a Longform project, closing Obsidian or sometimes even just clicking off of the project folder removes it from the plugin. The error code is as follows:

Uncaught (in promise) TypeError: Cannot read properties of null (reading 'length') at ignoredPatternToRegex (plugin:longform:36596:41) at eval (plugin:longform:36543:64) at Array.map () at StoreVaultSync.eval (plugin:longform:36543:53) at Generator.next () at fulfilled (plugin:longform:28:58)

I have tried changing the Longform settings of where the session data is stored and have had zero luck, regardless of choice. I have also done everything I can to ensure that other plugins do not interface with the longform tags

Akmedrah commented 1 week ago

I have just finished reinstalling and have the same issue. I have tried manually editing the data file in the plugin folder and it refuses to acknowledge that the file was changed. I changed the Session data storage to "as a .json file in the longform/ plugin folder" and tried to re-add things manually there to no effect. I changed the Session data storage to "as a file in your vault" and renamed the file to LF_DATA.json

The inside of the LF_DATA.json is as follows:

[ { "start": "2024-06-22T07:28:43.882Z", "total": 0, "drafts": { "001-ASCENSION/ASCENSION/Index.md": { "total": 0, "scenes": {} }, "002-THE_PRINCESSS_MAN/THE_PRINCESSS_MAN/Index.md": { "total": 0, "scenes": {} }, "003-WOLRD-REP/WORLD_REP/Index.md": { "total": 0, "scenes": {} }, "004-MONSTER-VERSE/RESURGENCE/Index.md": { "total": 0, "scenes": {} }, "005-LOTD/LEGION_OF_THE_DAMNED/Index.md": { "total": 0, "scenes": {} }, "006-A-WORLD-OF-RULES/A_WORLD_OF_RULES/Index.md": { "total": 0, "scenes": {} }, "007-VIS-VOLUNTATIS/VIS_VOLUNTATIS/Index.md": { "total": 0, "scenes": {} }, "011-MANALOCKED/MANALOCKED/Index.md": { "total": 0, "scenes": {} } } } ]

All of this has had zero effect. Projects are still failing to read. with the following error:

Uncaught (in promise) TypeError: Cannot read properties of null (reading 'length') at ignoredPatternToRegex (plugin:longform:36596:41) at eval (plugin:longform:36543:64) at Array.map () at StoreVaultSync.eval (plugin:longform:36543:53) at Generator.next () at fulfilled (plugin:longform:28:58)

Akmedrah commented 1 week ago

I could see that for some reason the pattern object was pulling empty array values from the index.md files.

Problem: The ignored files tag was saved with a single empty line like this: ` scenes:

Caused: Null value errors on pattern.length in the ignoredPatternToRegex function (line 36,594 in main.js)

Solution: Manually reset the ignored files tags in all index.md files like this: ` scenes:

This seems to have worked, but it did forget some of the files from my earlier troubleshooting. I will attempt to re-add.

Two suggestions for the good dev:

  1. Implement a check for 'empty' lines.
  2. Add the functionality to 'Open Existing Longform Project'
Akmedrah commented 1 week ago

A NOTE FOR OTHERS WITH THIS ISSUE

I you do not have a space between the colon ( : ) and the square brackets when you manually reset the ignored files it will not be parsed right. Make sure you have a space between the colon and the square brackets.