Changing property causes detail view to pop back to list view

I have a list view created from core data, and it's sectioned by a property called favourite. In the detail view a user is able to either add an item or remove it as a favourite.

When the property is updated, it causes the detail view to pop back to the list view, which I don't want it to do, and don't know how to get it to not do that

The creation of the list

    @SectionedFetchRequest var dims: SectionedFetchResults<Int16, DIM>

    init() {
        _dims = SectionedFetchRequest<Int16, DIM>(
            sectionIdentifier: \.favourite,
            sortDescriptors: [NSSortDescriptor(keyPath: \DIM.favourite, ascending: false), NSSortDescriptor(keyPath: \DIM.name, ascending: true)]
        )
    }

    List {
        ForEach(dims) { section in
            let header: String = nameForSectionHeader(sectionID: section.id)
            Section(header: Text(header)) {
                ForEach(section) { dim in
                    NavigationLink(destination: DIMListView(dim: dim)) {
                                   
                    }
                }
            }
        }
    }

and then on the detail view there's a toolbar with an option to add/remove favourite.

.toolbar {
    ToolbarItem(placement: .navigationBarTrailing) {
        Button("Options") {
            showingAlertFav = true
        }
        .alert("Choose an option", isPresented: $showingAlertFav) {
            if dim.favourite == 0 {
                Button("Favourite", role: .none) {
                    setFav(fav: 1)
                }
            } else {
                Button("Unfavourite", role: .none) {
                    setFav(fav: 0)
                }
            }
        }
    }
}


func setFav(fav : Int16) {
    dim.favourite = fav
    saveContext()
}
Changing property causes detail view to pop back to list view
 
 
Q