NotePlan / NotePlan/plugins

removeParagraphs() API not always working

Open
#544 4 comments 0 reactions 1 assignee View on GitHub

@EduardMe is already working on this.

Since Mar 14, 2024.

bug
Dominant language
JavaScript
Stars
204
Forks
82
Avg merge
22h 27m
Merged PRs (30d)
3

Description

Checks

  • I confirm I have restarted NotePlan and this problem still persists.
  • Is this a repeatable problem?

Describe the bug
Sometimes this line doesn't work (from jgclark.Filer/src/moveItems.js):
note.removeParagraphs(parasInBlock)

I cannot see any pattern to when this doesn't happen.
Note that I have added some logic now to flag up when this happens, by testing the number of lines in note before and after this call. See this example:

Plugin Console Log
This is the output from 3 successive examples of calling /moveParas on the same single line in the same note:

Executing function 'moveParasToTomorrow'
2024-03-14 23:33:33 | DEBUG | jgclark.Filer v1.1.5 :: moveParas: move current para only
2024-03-14 23:33:33 | DEBUG | jgclark.Filer v1.1.5 :: -> bottom of note, line 9
2024-03-14 23:33:33 | DEBUG | jgclark.Filer v1.1.5 :: - Removing 1 paras from original origNote (which had 33 paras)
Executing function 'moveParasToTomorrow'
2024-03-14 23:33:43 | DEBUG | jgclark.Filer v1.1.5 :: moveParas: move current para only
2024-03-14 23:33:43 | DEBUG | jgclark.Filer v1.1.5 :: -> bottom of note, line 10
2024-03-14 23:33:43 | DEBUG | jgclark.Filer v1.1.5 :: - Removing 1 paras from original origNote (which had 32 paras)
2024-03-14 23:33:43 🥺 WARN🥺 jgclark.Filer v1.1.5 ::   - WARNING: After delete there are 32 paragraphs
Executing function 'moveParasToTomorrow'
2024-03-14 23:35:07 | DEBUG | jgclark.Filer v1.1.5 :: moveParas: move current para only
2024-03-14 23:35:07 | DEBUG | jgclark.Filer v1.1.5 :: -> bottom of note, line 10
2024-03-14 23:35:07 | DEBUG | jgclark.Filer v1.1.5 :: - Removing 1 paras from original origNote (which had 32 paras)

Note that I have deliberately left good time between calls to mean it shouldn't be a caching issue.

Additional context
This has been happening a few times a week for me for at least a year.

@EduardMe is there anything more I can do to help you figure out what's causing this?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.