diff --git a/api/web/src/stores/cots.ts b/api/web/src/stores/cots.ts index 682e74f60..19165fedc 100644 --- a/api/web/src/stores/cots.ts +++ b/api/web/src/stores/cots.ts @@ -385,8 +385,6 @@ export const useCOTStore = defineStore('cots', { * Add a CoT GeoJSON to the store and modify props to meet MapLibre style requirements */ add: async function(feat: Feature, mission_guid?: string) { - feat = COT.style(feat); - mission_guid = mission_guid || this.subscriptionPending.get(feat.id); if (mission_guid) { diff --git a/api/web/src/stores/cots/cot.ts b/api/web/src/stores/cots/cot.ts index 89af24698..bf842e50c 100644 --- a/api/web/src/stores/cots/cot.ts +++ b/api/web/src/stores/cots/cot.ts @@ -35,17 +35,25 @@ export default class COT implements Feature { geometry: Feature["geometry"]; constructor(feat: Feature) { + feat = COT.style(feat); + this.id = feat.id || crypto.randomUUID(); this.type = feat.type || 'Feature'; this.path = feat.path || '/'; this.properties = feat["properties"] || {}; this.geometry = feat["geometry"]; + + if (!this.properties.archived) { + this.properties.archived = false + } } /** * Update the COT and return a boolean as to whether the COT needs to be re-rendered */ update(feat: Feature): boolean { + feat = COT.style(feat); + let changed = false; for (const prop of RENDERED_PROPERTIES) { if (this.properties[prop] !== feat.properties[prop]) {