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

Passage counter recounts existing passages when adding new ones #170

Open
SjoerdHekking opened this issue Nov 28, 2024 · 0 comments
Open

Comments

@SjoerdHekking
Copy link
Contributor

Information

When opening an existing file and adding a new passage, the passage counter incorrectly recounts all existing passages in the file, causing the counter to increase more than it should. Instead of incrementing by 1 (for the new passage), the counter includes all the passages in the newly opened file again, resulting in an inflated passage count.

Steps to Reproduce

  • Open a file that already contains passages.
  • Observe the passage counter (e.g., Passage Count: 10).
  • Add a new passage to the file.
  • Check the passage counter again.

Expected Behavior

The passage counter should increment by 1 to reflect the addition of the new passage (e.g., from Passage Count: 10 to Passage Count: 11).

Actual Behavior

The passage counter increases by the number of existing passages in the file plus 1. For example:

If there are 10 passages in total and a file with 3 unopened passages is opened, then adding a single passage causes the counter to jump to 14 instead of 11. See the attachments for proof.

Fix

I will work on the fix, I could do it "dirty" by checking for duplicates when ctx.workspaceState.get("passages", []) as Passage[]; is assigned to a variable. However, this fix is temporary and doesn't fix the underlying problem.

Attachments

image
image
GwenMaxine already added on 934 is re-added at 997 after opening the file.tw and adding a new passage to that file.

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

No branches or pull requests

1 participant