git-stack-cli 1.6.0 → 1.6.1

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.
@@ -28700,10 +28700,17 @@ function SelectCommitRanges() {
28700
28700
  function SelectCommitRangesInternal(props) {
28701
28701
  const actions = Store.useActions();
28702
28702
  const argv = Store.useState((state) => state.argv);
28703
- const [selected_group_id, set_selected_group_id] = reactExports.useState(props.commit_range.UNASSIGNED);
28703
+ const [selected_group_id, set_selected_group_id] = reactExports.useState(() => {
28704
+ const first_group = props.commit_range.group_list.find((g) => g.id !== props.commit_range.UNASSIGNED);
28705
+ if (first_group) {
28706
+ return first_group.id;
28707
+ }
28708
+ return props.commit_range.UNASSIGNED;
28709
+ });
28704
28710
  const [group_input, set_group_input] = reactExports.useState(false);
28705
28711
  const [new_group_list, create_group] = reactExports.useReducer((group_list, group) => {
28706
- return group_list.concat(group);
28712
+ const next_group_list = group_list.concat(group);
28713
+ return next_group_list;
28707
28714
  }, []);
28708
28715
  const [commit_map, update_commit_map] = reactExports.useReducer((map, args) => {
28709
28716
  map.set(args.key, args.value);
@@ -28724,9 +28731,10 @@ function SelectCommitRangesInternal(props) {
28724
28731
  unassigned_count++;
28725
28732
  }
28726
28733
  }
28727
- group_list.push(...new_group_list);
28728
28734
  const total_group_count = new_group_list.length + props.commit_range.group_list.length;
28729
- for (const group of props.commit_range.group_list) {
28735
+ for (let i = 0; i < props.commit_range.group_list.length; i++) {
28736
+ const index = props.commit_range.group_list.length - i - 1;
28737
+ const group = props.commit_range.group_list[index];
28730
28738
  if (group.pr?.state === "MERGED")
28731
28739
  continue;
28732
28740
  if (group.id === props.commit_range.UNASSIGNED) {
@@ -28744,6 +28752,7 @@ function SelectCommitRangesInternal(props) {
28744
28752
  title: group.pr?.title || group.title || group.id,
28745
28753
  });
28746
28754
  }
28755
+ group_list.push(...new_group_list);
28747
28756
  let current_index = group_list.findIndex((g) => g.id === selected_group_id);
28748
28757
  if (current_index === -1) {
28749
28758
  current_index = 0;
@@ -34452,7 +34461,7 @@ async function command() {
34452
34461
  .wrap(123)
34453
34462
  // disallow unknown options
34454
34463
  .strict()
34455
- .version("1.6.0" )
34464
+ .version("1.6.1" )
34456
34465
  .showHidden("show-hidden", "Show hidden options via `git stack help --show-hidden`")
34457
34466
  .help("help", "Show usage via `git stack help`").argv);
34458
34467
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "git-stack-cli",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "",
5
5
  "author": "magus",
6
6
  "license": "MIT",
@@ -35,15 +35,24 @@ function SelectCommitRangesInternal(props: Props) {
35
35
 
36
36
  const argv = Store.useState((state) => state.argv);
37
37
 
38
- const [selected_group_id, set_selected_group_id] = React.useState(
39
- props.commit_range.UNASSIGNED
40
- );
38
+ const [selected_group_id, set_selected_group_id] = React.useState(() => {
39
+ const first_group = props.commit_range.group_list.find(
40
+ (g) => g.id !== props.commit_range.UNASSIGNED
41
+ );
42
+
43
+ if (first_group) {
44
+ return first_group.id;
45
+ }
46
+
47
+ return props.commit_range.UNASSIGNED;
48
+ });
41
49
 
42
50
  const [group_input, set_group_input] = React.useState(false);
43
51
 
44
52
  const [new_group_list, create_group] = React.useReducer(
45
53
  (group_list: Array<SimpleGroup>, group: SimpleGroup) => {
46
- return group_list.concat(group);
54
+ const next_group_list = group_list.concat(group);
55
+ return next_group_list;
47
56
  },
48
57
  []
49
58
  );
@@ -79,12 +88,13 @@ function SelectCommitRangesInternal(props: Props) {
79
88
  }
80
89
  }
81
90
 
82
- group_list.push(...new_group_list);
83
-
84
91
  const total_group_count =
85
92
  new_group_list.length + props.commit_range.group_list.length;
86
93
 
87
- for (const group of props.commit_range.group_list) {
94
+ for (let i = 0; i < props.commit_range.group_list.length; i++) {
95
+ const index = props.commit_range.group_list.length - i - 1;
96
+ const group = props.commit_range.group_list[index];
97
+
88
98
  if (group.pr?.state === "MERGED") continue;
89
99
 
90
100
  if (group.id === props.commit_range.UNASSIGNED) {
@@ -105,6 +115,8 @@ function SelectCommitRangesInternal(props: Props) {
105
115
  });
106
116
  }
107
117
 
118
+ group_list.push(...new_group_list);
119
+
108
120
  let current_index = group_list.findIndex((g) => g.id === selected_group_id);
109
121
  if (current_index === -1) {
110
122
  current_index = 0;