Skip to content

Commit

Permalink
fix item view. (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
Livinglist authored May 8, 2023
1 parent 46c1b85 commit f51e76f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,12 @@ public class StoriesRepository {
switch type {
case "story":
let story = try? JSONDecoder().decode(Story.self, from: data)
return story
let filteredText = story?.text.htmlStripped.withExtraLineBreak
return story?.copyWith(text: filteredText)
case "comment":
let comment = try? JSONDecoder().decode(Comment.self, from: data)
return comment
let filteredText = comment?.text.htmlStripped.withExtraLineBreak
return comment?.copyWith(text: filteredText)
default:
return nil
}
Expand Down
5 changes: 3 additions & 2 deletions Shared/Models/ItemStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ extension ItemView {
func loadKids(of cmt: Comment) async {
if let parentIndex = kids.firstIndex(of: cmt),
let kids = cmt.kids,
let level = cmt.level {
let level = cmt.level,
loadingItem == nil {
self.loadingItem = cmt.id

var comments = [Comment]()
Expand All @@ -23,11 +24,11 @@ extension ItemView {
comments.append(comment.copyWith(level: level + 1))
}

self.loadingItem = nil
self.loadedItems.insert(cmt.id)
withAnimation {
self.kids.insert(contentsOf: comments, at: parentIndex + 1)
}
self.loadingItem = nil
}
}

Expand Down
4 changes: 2 additions & 2 deletions ZCombinator.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = "ZCombinator (iOS).entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 5;
CURRENT_PROJECT_VERSION = 7;
DEVELOPMENT_TEAM = QMWX3X2NF7;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
Expand Down Expand Up @@ -1005,7 +1005,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = "ZCombinator (iOS).entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 5;
CURRENT_PROJECT_VERSION = 7;
DEVELOPMENT_TEAM = QMWX3X2NF7;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
Expand Down

0 comments on commit f51e76f

Please sign in to comment.