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

maintain import tables; document clearing; fix import bugs #284

Merged
merged 1 commit into from
Dec 26, 2024

Conversation

cloverich
Copy link
Owner

@cloverich cloverich commented Dec 24, 2024

  • re-work import process to maintain data in import table by default
  • fix staging error tracking so staging errors are kept but cleared on re-run
  • expose clear import tables button on settings, document it
  • fix bug where tags or wikilinks in document would cause import to fail at staging phase (+test)
  • fix bug where same filename from different import would be preferentially used
  • fix bug where empty document would fail to import (potentially leaving valid title / frontmatter behind) (+test)
  • add success message when clear import button succeeds

Import errors can now be found in the table and I used this process to fix my own notes, rather than have Chronicles attempt to repair everything on import (scope was blowing up). Exposed a button to clear import tables, to allow re-importing.
Screenshot 2024-12-24 at 8 01 11 AM

Note a great UX, but these two paths are possible (and I used them myself):

  1. Tons of errors or unexpected issues. Delete files in Chronicles, then re-run import
  2. A few issues identified at staging. Fix the source documents (example: add quotes to titles with colons in them) and then re-run the import

Staging errors are cleared automatically on each import run; everything else is persisted so re-running the importer will not create duplicate files. One major limitation is if imports are done in batches (while fixing errors), links between correct vs broken notes won't be setup properly. Chronicles could fix this, and / or could track links to surface it, but that's yet more scope. Can re-visit in future if app see's usage.

NOTE: This is the final (planned) PR in #247; at this point I can run an import from:

  • My prior Chronicles directory
  • My Obsidian directory
  • My exported Notion directory

And all three show up in Chronicles in a functional state. There's still edge cases I don't handle (noted in code); performance of sync is bad; the IDs dont sort the way I'd hoped. But at this point the original intent of v0.8 is complete.

Closes #276

@cloverich cloverich force-pushed the cloverich/keep_import_tables branch from 8c776a0 to 43dc774 Compare December 25, 2024 18:46
@@ -38,7 +38,7 @@ export class FilesImportResolver {
): Promise<string | undefined> => {
// check db for chronicles id matching name, if any
const result = await this.knex("import_files")
.where({ filename: name })
.where({ filename: name, importerId: this.importerId })
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If no importerId, may grab files from different imports, specifically from different import directories. Since the current wikilinks do not handle duplicate file names, this could (did) result in e.g. a different image or video than in the original note being displayed (if they had the same name).

- re-work import process to maintain data in import table by default
- fix staging error tracking so staging errors are kept but cleared on re-run
- expose clear import tables button on settings, document it
- fix bug where tags or wikilinks in document would cause import to fail at staging phase
- fix bug where same filename from different import would be preferentially used
- fix bug where empty document would fail to import (potentially leaving valid title / frontmatter behind)
- add success message when clear import button succeeds
@cloverich cloverich force-pushed the cloverich/keep_import_tables branch from 43dc774 to a29957f Compare December 25, 2024 19:24
@cloverich cloverich merged commit 228e3ba into master Dec 26, 2024
2 checks passed
@cloverich cloverich deleted the cloverich/keep_import_tables branch December 26, 2024 15:23
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

Successfully merging this pull request may close these issues.

Do not clear import tables on subsequent imports
1 participant