Re-select selected communication on fetch
This makes it so the UI updates with any changes we pull down.
This commit is contained in:
parent
a8f2c87e38
commit
70d3aef8b3
3 changed files with 12 additions and 6 deletions
|
|
@ -101,6 +101,15 @@
|
|||
|
||||
const data = await response.json();
|
||||
this.communications = data.communications || data; // Handle different response formats
|
||||
// if we already had something selected, reset it using the new data
|
||||
if (this.selectedCommunication) {
|
||||
const matching = this.communications.filter((report) => {
|
||||
return report.id == this.selectedCommunication.id;
|
||||
});
|
||||
if (matching.length > 0) {
|
||||
this.selectedCommunication = matching[0];
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("Error loading communications:", err);
|
||||
throw err;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue