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

Fix performance issue in ProfileView #1744

Merged
merged 2 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added ability to delete lists. [#136](https://github.com/verse-pbc/issues/issues/136)
- Added analytics for feed source selection and lists. [#129](https://github.com/verse-pbc/issues/issues/129)
- Fixed: while searching for users to add to a list, NIP-05 searches dismiss the view. [#165](https://github.com/verse-pbc/issues/issues/165)
- Fixed a performance issue that could occur after switching tabs. [#171](https://github.com/verse-pbc/issues/issues/171)

### Internal Changes
- Added function for creating a new list and a test verifying list editing. [#112](https://github.com/verse-pbc/issues/issues/112)
Expand Down
2 changes: 1 addition & 1 deletion Nos/Views/Components/Author/AuthorCard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ enum AvatarOverlayMode {
/// This view displays the information we have for an author suitable for being used in a list.
struct AuthorCard<AvatarOverlay: View>: View {

@ObservedObject var author: Author
var author: Author
@Environment(CurrentUser.self) var currentUser

let avatarOverlayView: () -> AvatarOverlay?
Expand Down
2 changes: 1 addition & 1 deletion Nos/Views/Components/Author/AuthorLabel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import SwiftUI

struct AuthorLabel: View {

@ObservedObject var author: Author
var author: Author
var note: Event?

private var attributedAuthor: AttributedString {
Expand Down
2 changes: 1 addition & 1 deletion Nos/Views/Components/Author/NIP05View.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import SwiftUI

/// Displays a user's NIP-05 in multiple colors and does some verification on it.
struct NIP05View: View {
@ObservedObject var author: Author
var author: Author

@State private var verifiedNip05Identifier: Bool?
@Dependency(\.namesAPI) private var namesAPI
Expand Down
2 changes: 1 addition & 1 deletion Nos/Views/Components/BioView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import SwiftUI

struct BioView: View {

@ObservedObject var author: Author
var author: Author

@Environment(\.managedObjectContext) private var viewContext

Expand Down
2 changes: 1 addition & 1 deletion Nos/Views/Components/Button/CircularButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import SwiftUI
/// Allows the current user to follow or unfollow the author,
/// and updates its own appearance based on follow state.
struct CircularFollowButton: View {
@ObservedObject var author: Author
var author: Author
@Environment(CurrentUser.self) private var currentUser
@Dependency(\.analytics) private var analytics
@Dependency(\.crashReporting) private var crashReporting
Expand Down
2 changes: 1 addition & 1 deletion Nos/Views/Components/Button/FollowButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import CoreData

struct FollowButton: View {
@ObservedObject var currentUserAuthor: Author
@ObservedObject var author: Author
var author: Author
/// A flag used to show a follow or unfollow icon in addition to Follow or
/// Unfollow text.
var shouldDisplayIcon = false
Expand Down
2 changes: 1 addition & 1 deletion Nos/Views/Components/GoldenPostView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ let goldenRatio: CGFloat = 0.618

struct GoldenPostView: View {

@ObservedObject var author: Author
var author: Author
@ObservedObject var note: Event

@EnvironmentObject private var router: Router
Expand Down
2 changes: 1 addition & 1 deletion Nos/Views/Components/KnownFollowersView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import SwiftUI
/// impersonation attacks by making sure they choose the right person to follow, mention, message, etc.
struct KnownFollowersView: View {

@ObservedObject var author: Author
var author: Author

/// The authors that the `source` author follows who also follow the `author`
@FetchRequest private var knownFollowers: FetchedResults<Author>
Expand Down
2 changes: 1 addition & 1 deletion Nos/Views/Home/HomeTab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ fileprivate struct PopoverTipView: View {
}

struct HomeTab: View {
@ObservedObject var user: Author
var user: Author

@EnvironmentObject private var router: Router
@ObserveInjection var inject
Expand Down
2 changes: 1 addition & 1 deletion Nos/Views/Note/NoteCardHeader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import SwiftUI
struct NoteCardHeader: View {

@ObservedObject var note: Event
@ObservedObject var author: Author
var author: Author

var body: some View {
HStack(alignment: .center, spacing: 8) {
Expand Down
2 changes: 1 addition & 1 deletion Nos/Views/Profile/ActivityPubBadgeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import SwiftUI
/// A view that displays a badge with an ActivityPub icon.
struct ActivityPubBadgeView: View {

@ObservedObject var author: Author
var author: Author

var fediverseServer: String {
let regex = /[0-9A-Za-z._-]+@(?<fediverse>[0-9A-Za-z._-]+)\.mostr\.pub/
Expand Down
2 changes: 1 addition & 1 deletion Nos/Views/Profile/BioSheet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import SwiftUI

/// Shows the name, nip-05 and bio of a given user in a vertical stack.
struct BioSheet: View {
@ObservedObject var author: Author
var author: Author

@Environment(\.managedObjectContext) private var viewContext
@Dependency(\.noteParser) private var noteParser
Expand Down
2 changes: 1 addition & 1 deletion Nos/Views/Profile/Edit/ProfileEditView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ struct ProfileEditView: View {

@Dependency(\.crashReporting) private var crashReporting

@ObservedObject var author: Author
var author: Author

@State private var displayNameText: String = ""
@State private var bioText: String = ""
Expand Down
2 changes: 1 addition & 1 deletion Nos/Views/Profile/ProfileHeader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import CoreData
import Logger

struct ProfileHeader: View {
@ObservedObject var author: Author
var author: Author
@Environment(CurrentUser.self) private var currentUser

@Binding private var selectedTab: ProfileFeedType
Expand Down
2 changes: 1 addition & 1 deletion Nos/Views/Profile/ProfileTab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import SwiftUI
struct ProfileTab: View {

@Environment(CurrentUser.self) var currentUser
@ObservedObject var author: Author
var author: Author

@Binding var path: NavigationPath

Expand Down
2 changes: 1 addition & 1 deletion Nos/Views/Profile/ProfileView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Logger

struct ProfileView: View {

@ObservedObject var author: Author
var author: Author
var addDoubleTapToPop = false

@Environment(\.managedObjectContext) private var viewContext
Expand Down
2 changes: 1 addition & 1 deletion Nos/Views/Relay/RelayView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct RelayView: View {
@Environment(\.managedObjectContext) private var viewContext
@Environment(RelayService.self) private var relayService
@Environment(CurrentUser.self) private var currentUser
@ObservedObject var author: Author
var author: Author

@State var newRelayAddress: String = ""

Expand Down