@smartnet360/svelte-components 0.0.73 → 0.0.74
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -74,10 +74,22 @@ export function createCellStoreContext(cells) {
|
|
|
74
74
|
});
|
|
75
75
|
// Derived: Filter cells by status based on includePlannedCells flag
|
|
76
76
|
// IMPORTANT: This is a pure $derived - it only READS from state, never writes
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
// Memoized to avoid re-filtering when cells array reference hasn't changed
|
|
78
|
+
let lastCellsRef = null;
|
|
79
|
+
let lastIncludePlanned = null;
|
|
80
|
+
let cachedFilteredCells = [];
|
|
81
|
+
let cellsFilteredByStatus = $derived.by(() => {
|
|
82
|
+
// Only recompute if cells reference or flag changed
|
|
83
|
+
if (state.cells === lastCellsRef && state.includePlannedCells === lastIncludePlanned) {
|
|
84
|
+
return cachedFilteredCells;
|
|
85
|
+
}
|
|
86
|
+
lastCellsRef = state.cells;
|
|
87
|
+
lastIncludePlanned = state.includePlannedCells;
|
|
88
|
+
cachedFilteredCells = state.includePlannedCells
|
|
89
|
+
? state.cells // Include all cells
|
|
90
|
+
: state.cells.filter(cell => cell.status.startsWith('On_Air')); // Only On Air cells
|
|
91
|
+
return cachedFilteredCells;
|
|
92
|
+
});
|
|
81
93
|
// Auto-save settings when they change
|
|
82
94
|
$effect(() => {
|
|
83
95
|
// Convert Map to plain object for serialization
|
|
@@ -90,10 +90,23 @@ export function createRepeaterStoreContext(repeaters) {
|
|
|
90
90
|
minLabelZoom: persistedSettings.minLabelZoom ?? 10 // Lower default to show labels at more zoom levels
|
|
91
91
|
});
|
|
92
92
|
// Derived: Filter repeaters by visible tech:fband combinations
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
// Memoized to avoid re-filtering when repeaters array or visibleTechBands haven't changed
|
|
94
|
+
let lastRepeatersRef = null;
|
|
95
|
+
let lastVisibleTechBands = null;
|
|
96
|
+
let cachedFilteredRepeaters = [];
|
|
97
|
+
let filteredRepeaters = $derived.by(() => {
|
|
98
|
+
// Only recompute if repeaters reference or visible tech bands changed
|
|
99
|
+
if (state.repeaters === lastRepeatersRef && state.visibleTechBands === lastVisibleTechBands) {
|
|
100
|
+
return cachedFilteredRepeaters;
|
|
101
|
+
}
|
|
102
|
+
lastRepeatersRef = state.repeaters;
|
|
103
|
+
lastVisibleTechBands = state.visibleTechBands;
|
|
104
|
+
cachedFilteredRepeaters = state.repeaters.filter(r => {
|
|
105
|
+
const key = `${r.tech}:${r.fband}`;
|
|
106
|
+
return state.visibleTechBands.has(key);
|
|
107
|
+
});
|
|
108
|
+
return cachedFilteredRepeaters;
|
|
109
|
+
});
|
|
97
110
|
// Auto-save settings when they change
|
|
98
111
|
$effect(() => {
|
|
99
112
|
// Convert Set to Array and Map to Object for serialization
|