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

Refresh Feed + Profile view after successful recovery #912

Merged
merged 6 commits into from
Oct 2, 2023

Conversation

bfollington
Copy link
Collaborator

@bfollington bfollington commented Sep 28, 2023

Ensures the feed is populated when dismissing recovery mode after a successful recovery. Refreshing the profile is less important, given that the feed is the default tab, but probably still worth refreshing it to be safe.

I found a few other refresh and notification-centric issues too.

Changes

  • Refresh feed after successful recovery
  • Refresh profile after successful recovery
  • Refresh feed based on DetailStack notifications
  • Rename NotebookAction's for detail stack for consistency (succeedSaveMemo -> succeedSaveEntry)
  • Extract logic from NotebookModel that should be in DetailStackModel
  • Refresh Notebook when switching to Notebook Tab

Ensures the feed is populated when dismissing recovery
@bfollington bfollington force-pushed the 2023-09-29-refresh-feed-and-profile branch from 9ae5115 to 609d7a2 Compare September 29, 2023 00:30
@bfollington bfollington mentioned this pull request Sep 29, 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 few questions.

It may be worth adding tests for DetailStack move/merge/audience update functions, since the logic involved in these is easy to get wrong.

}
}


static func detailStackNotification(
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems somewhat surprisingly named to me. AFAICT, it's not sending up a notification, but forwarding down an intercepted action?

It's also somewhat unusual to have an update fn that takes an action from another context.

I think it might be more straightforward to have these update arms inlined, or given separate static methods. I think that might make them easier to test, or to handle behavior differently in future.

Copy link
Collaborator Author

@bfollington bfollington Oct 2, 2023

Choose a reason for hiding this comment

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

I've inlined the update calls, but I'm not sure that this makes sense to me:

It's also somewhat unusual to have an update fn that takes an action from another context.

It's just extracting common functionality in a way that's almost identical to a cursor's update function, perhaps if it were named forwardWithRefresh it wouldn't seem so odd? Given the footgun opportunity to omit .detailStack() around the forwarded actions I thought one mapping site was safer & equally testable (I made this mistake during the refactor).

I suppose I don't see a reason to repeatedly write the same code 4 times upfront, you can always branch one out if/when it's called for.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Fair point. If you like, we can leave as-was, but I would prefer a different name, since notification is used elsewhere to mean "sending a message up into another parent context we don't know anything about"

bfollington added a commit that referenced this pull request Oct 2, 2023
Working on #912
I realised that merging notes was broken.

The addresses for merge suggestions were not being relativized when
retrieved from SQLite, so they had a `peer` of `.did()` which made
`writeMemo` blow up thinking it couldn't write to that path.

I've changed `searchRenameSuggestions` to relativize addresses.
@bfollington
Copy link
Collaborator Author

@gordonbrander I've added tests for DetailStack for:

  • update audience
  • delete
  • move
  • merge

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!

@gordonbrander gordonbrander merged commit d088130 into main Oct 2, 2023
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.

2 participants