Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

Refresh backlinks regardless of whether editor content is stale #859

Merged
merged 15 commits into from
Sep 7, 2023

Conversation

bfollington
Copy link
Collaborator

@bfollington bfollington commented Aug 9, 2023

Fixes #857

Changes

  • Backlinks are now loaded independently of the memo in both the viewer and editor
  • Backlinks are refreshed regardless of whether the editor content is refresh on .appear
  • DataService.readMemoDetail and DataService.readEditorMemoDetail are both much simpler due to the introduction of DataService.readMemoBacklinks
  • Both the viewer an editor will refresh backlinks and transcludes (in the case of the viewer) if indexing completes in the BG
    • To accomplish this I had to pass app down to the viewer and editor so they can replay select actions
    • I'd already done this on the profile, so I refactored into a common .fromAppAction pattern

@bfollington
Copy link
Collaborator Author

After chatting to @gordonbrander we think it's more sensible to hold off merging this and split apart backlink refresh from editor content refresh.

@bfollington bfollington force-pushed the 2023-08-09-stale-backlinks branch from eb9252e to e3253c8 Compare August 11, 2023 01:01
@bfollington bfollington changed the title Invalidate current editor detail if backlinks do not match Refresh backlinks regardless of whether editor content is stale Aug 11, 2023
Copy link
Collaborator

@gordonbrander gordonbrander left a comment

Choose a reason for hiding this comment

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

A couple notes

Copy link
Collaborator

@gordonbrander gordonbrander left a comment

Choose a reason for hiding this comment

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

Direction looks good to me, but I have a few requests.

@@ -11,7 +11,6 @@ import Foundation
struct MemoEditorDetailResponse: Hashable {
var saveState: SaveState
var entry: MemoEntry
var backlinks: [EntryStub] = []
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since this struct only carries an entry now, should we just respond with a MemoEntry?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think we still want to attach saveState here, so the struct makes sense?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oops, missed that. You're right.

let model = prepareLoadDetail(state)
return Update(state: model, fx: fx)
var model = prepareLoadDetail(state)
model.address = address
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Address must be set on model to fetch backlinks as early as possible.

@bfollington bfollington force-pushed the 2023-08-09-stale-backlinks branch from c13da83 to 68867aa Compare September 1, 2023 07:18
Copy link
Collaborator

@gordonbrander gordonbrander left a comment

Choose a reason for hiding this comment

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

LGTM

Would suggest playtesting since this touches the editor:

  • Creating a note
  • Deleting a note
  • Renaming a note
  • Creating a new note A, linking off to another new note B from it, following link to create B... does A show up in the related notes section?
  • Opening the same note multiple times, changing the top one, paging back to the lower one. What happens?

@bfollington bfollington force-pushed the 2023-08-09-stale-backlinks branch from 23f6afb to 6921248 Compare September 7, 2023 22:27
@bfollington bfollington merged commit fa508bc into main Sep 7, 2023
@bfollington bfollington deleted the 2023-08-09-stale-backlinks branch September 7, 2023 23:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stale data in backlinks view when navigating "back" in history
2 participants