Skip to content

Comments

Select console items using Notifications#279

Closed
AvdLee wants to merge 2 commits intokean:mainfrom
AvdLee:feature/notification-driven-selection
Closed

Select console items using Notifications#279
AvdLee wants to merge 2 commits intokean:mainfrom
AvdLee:feature/notification-driven-selection

Conversation

@AvdLee
Copy link
Collaborator

@AvdLee AvdLee commented Jul 3, 2024

I've removed a bunch of unused code inside the macOS ConsoleListView and integrated an option to select entities using a new notification.

@kean note that I'm still using my fork, so there's other changes in this PR from the previous one. I'll migrate my project later this week!

@AvdLee AvdLee self-assigned this Jul 3, 2024
guard let managedObjectID = notification.object as? NSManagedObjectID else { return }
selection = ConsoleSelectedItem.entity(managedObjectID)
}
#endif
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the code regarding notification driven selection


@State private var selectedObjectID: NSManagedObjectID? // Has to use for Table
@State private var selection: ConsoleSelectedItem?
@State private var shareItems: ShareItems?
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

A bunch of these properties were not used. I guess due to refactors over time?

Divider()
ScrollViewReader { proxy in
List(selection: $selection) {
List(selection: $router.selection) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

By linking directly to the router, we can remove local state and keep the view in sync with the router at all times.

@kean
Copy link
Owner

kean commented Sep 3, 2024

As suggested in #278 (comment), I recommend creating separate packages for it. I would also avoid relying on these top-level componts like the router cause they might change. It should be safe to use the individual private leaf views.

@kean kean closed this Sep 3, 2024
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.

2 participants