- 
                Notifications
    
You must be signed in to change notification settings  - Fork 104
 
Open
Description
I have the QGrid setup to render a list of objects that are converted to views inside the QGrid’s block.
When my API fetches updated data the view is rebuilt.
I confirmed that the QGrid is called again, yet, it keeps rendering the initial list of views and not the newly created views.
If I switch to List it works properly. Only with QGrid it doesn’t refresh.
Here is the code in question:
    var body: some View { self.makeView()
        .onReceive(timer) { _ in
            self.refreshView()
        }
    }
    
    private func makeView() -> some View {
        VStack {
                Text("Dashboard").font(.largeTitle)
            if self.circuits.count > 0 {
                // need to use an if, b/c showing scrollable view without content will not refresh later on
                    QGrid<[CircuitInfo], CircuitCell>(self.circuits, columns: 2, columnsInLandscape: 4, vSpacing: 10, vPadding: 10, isScrollable: true) { circuit in
                        CircuitCell(circuit: circuit)
                }
            }
            Spacer()
            HStack {
                Text("\(self.circuitsCount())").font(.footnote).padding(5)
                Spacer()
                Text("Updated: \(lastUpdated)").font(.footnote).padding(5)
            }
        }
    }
Any ideas as to what I might be doing wrong?
Metadata
Metadata
Assignees
Labels
No labels