@overmap-ai/core 1.0.71-workspace-settings.8 → 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.
@@ -1123,7 +1123,16 @@ const selectAssetStageById = (id) => (state) => {
1123
1123
  return state.assetStageReducer.instances[id];
1124
1124
  };
1125
1125
  const selectAssetStages = createSelector([selectStageMapping], (stageMapping) => {
1126
- return Object.values(stageMapping);
1126
+ const stages = Object.values(stageMapping);
1127
+ console.debug(
1128
+ "Raw stages from store:",
1129
+ stages.map((s) => ({
1130
+ id: s.offline_id,
1131
+ priority: s.priority,
1132
+ name: s.name
1133
+ }))
1134
+ );
1135
+ return stages;
1127
1136
  });
1128
1137
  const selectAssetTypeStagesMapping = restructureCreateSelectorWithArgs(
1129
1138
  createSelector([selectStageMapping, (_state, assetTypeId) => assetTypeId], (stagesMapping, assetTypeId) => {
@@ -1138,10 +1147,24 @@ const selectAssetTypeStagesMapping = restructureCreateSelectorWithArgs(
1138
1147
  );
1139
1148
  const selectStagesOfAssetType = restructureCreateSelectorWithArgs(
1140
1149
  createSelector([selectAssetStages, (_state, assetTypeId) => assetTypeId], (stages, assetTypeId) => {
1141
- const stagesOfAssetType = [...stages].filter((stage) => stage.asset_type === assetTypeId);
1142
- const sortedStages = [...stagesOfAssetType].sort((a, b) => a.priority - b.priority);
1150
+ const stagesCopy = Array.from(stages);
1151
+ console.debug(
1152
+ "Original stages:",
1153
+ stagesCopy.map((s) => ({ id: s.offline_id, priority: s.priority }))
1154
+ );
1155
+ const stagesOfAssetType = stagesCopy.filter((stage) => stage.asset_type === assetTypeId);
1156
+ console.debug(
1157
+ "Filtered stages:",
1158
+ stagesOfAssetType.map((s) => ({ id: s.offline_id, priority: s.priority }))
1159
+ );
1160
+ const sortedStages = Array.from(stagesOfAssetType).sort((a, b) => {
1161
+ const priorityDiff = a.priority - b.priority;
1162
+ if (priorityDiff !== 0)
1163
+ return priorityDiff;
1164
+ return a.offline_id.localeCompare(b.offline_id);
1165
+ });
1143
1166
  console.debug(
1144
- "SORTED STAGES",
1167
+ "Sorted stages:",
1145
1168
  sortedStages.map((s) => ({ id: s.offline_id, priority: s.priority }))
1146
1169
  );
1147
1170
  return fallbackToEmptyArray(sortedStages);