@overmap-ai/core 1.0.71-workspace-settings.7 → 1.0.71-workspace-settings.9

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.
@@ -1112,7 +1112,16 @@ var __publicField = (obj, key, value) => {
1112
1112
  return state.assetStageReducer.instances[id];
1113
1113
  };
1114
1114
  const selectAssetStages = toolkit.createSelector([selectStageMapping], (stageMapping) => {
1115
- return Object.values(stageMapping);
1115
+ const stages = Object.values(stageMapping);
1116
+ console.debug(
1117
+ "Raw stages from store:",
1118
+ stages.map((s) => ({
1119
+ id: s.offline_id,
1120
+ priority: s.priority,
1121
+ name: s.name
1122
+ }))
1123
+ );
1124
+ return stages;
1116
1125
  });
1117
1126
  const selectAssetTypeStagesMapping = restructureCreateSelectorWithArgs(
1118
1127
  toolkit.createSelector([selectStageMapping, (_state, assetTypeId) => assetTypeId], (stagesMapping, assetTypeId) => {
@@ -1127,10 +1136,24 @@ var __publicField = (obj, key, value) => {
1127
1136
  );
1128
1137
  const selectStagesOfAssetType = restructureCreateSelectorWithArgs(
1129
1138
  toolkit.createSelector([selectAssetStages, (_state, assetTypeId) => assetTypeId], (stages, assetTypeId) => {
1130
- const stagesOfAssetType = [...stages].filter((stage) => stage.asset_type === assetTypeId);
1131
- const sortedStages = [...stagesOfAssetType].sort((a, b) => a.priority - b.priority);
1139
+ const stagesCopy = Array.from(stages);
1140
+ console.debug(
1141
+ "Original stages:",
1142
+ stagesCopy.map((s) => ({ id: s.offline_id, priority: s.priority }))
1143
+ );
1144
+ const stagesOfAssetType = stagesCopy.filter((stage) => stage.asset_type === assetTypeId);
1145
+ console.debug(
1146
+ "Filtered stages:",
1147
+ stagesOfAssetType.map((s) => ({ id: s.offline_id, priority: s.priority }))
1148
+ );
1149
+ const sortedStages = Array.from(stagesOfAssetType).sort((a, b) => {
1150
+ const priorityDiff = a.priority - b.priority;
1151
+ if (priorityDiff !== 0)
1152
+ return priorityDiff;
1153
+ return a.offline_id.localeCompare(b.offline_id);
1154
+ });
1132
1155
  console.debug(
1133
- "SORTED STAGES",
1156
+ "Sorted stages:",
1134
1157
  sortedStages.map((s) => ({ id: s.offline_id, priority: s.priority }))
1135
1158
  );
1136
1159
  return fallbackToEmptyArray(sortedStages);