@kubohiroya/turbowarp-plus-editor-git 0.14.0 → 0.14.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.
- package/dist/index.js +3 -4
- package/package.json +1 -1
- package/src/index.tsx +7 -5
package/dist/index.js
CHANGED
|
@@ -3574,26 +3574,25 @@ function GitPanel({ vm, document, host, controller }) {
|
|
|
3574
3574
|
});
|
|
3575
3575
|
running.current = true;
|
|
3576
3576
|
const ticket = ++epoch.current;
|
|
3577
|
-
|
|
3577
|
+
if (!automatic) setState((previous) => _objectSpread2$1(_objectSpread2$1({}, previous), {}, {
|
|
3578
3578
|
busy: true,
|
|
3579
3579
|
error: null,
|
|
3580
3580
|
notice: void 0
|
|
3581
3581
|
}));
|
|
3582
3582
|
try {
|
|
3583
3583
|
const update = await operation();
|
|
3584
|
-
if (epoch.current === ticket) setState((previous) => _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, previous), update), {}, { busy: false }));
|
|
3584
|
+
if (epoch.current === ticket) setState((previous) => _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, previous), update), {}, { busy: automatic ? previous.busy : false }));
|
|
3585
3585
|
} catch (error) {
|
|
3586
3586
|
if (epoch.current !== ticket) return;
|
|
3587
3587
|
const code = error instanceof GitPanelError ? error.code : "failed";
|
|
3588
3588
|
if (automatic && code === "changed") {
|
|
3589
3589
|
handled.current = null;
|
|
3590
|
-
setState((previous) => _objectSpread2$1(_objectSpread2$1({}, previous), {}, { busy: false }));
|
|
3591
3590
|
return;
|
|
3592
3591
|
}
|
|
3593
3592
|
const message = labels[code] || labels.failed;
|
|
3594
3593
|
setState((previous) => _objectSpread2$1(_objectSpread2$1({}, previous), {}, {
|
|
3595
3594
|
error: automatic && previous.error ? previous.error : message,
|
|
3596
|
-
busy: false,
|
|
3595
|
+
busy: automatic ? previous.busy : false,
|
|
3597
3596
|
diff: null
|
|
3598
3597
|
}));
|
|
3599
3598
|
} finally {
|
package/package.json
CHANGED
package/src/index.tsx
CHANGED
|
@@ -112,22 +112,24 @@ function GitPanel({vm, document, host, controller}: {vm: object; document: Docum
|
|
|
112
112
|
if (automatic) background.current = new Promise(resolve => {settle = resolve;});
|
|
113
113
|
running.current = true;
|
|
114
114
|
const ticket = ++epoch.current;
|
|
115
|
-
// An automatic refresh keeps the current error and notice, such as an uncertain push result.
|
|
116
|
-
|
|
115
|
+
// An automatic refresh keeps the current error and notice, such as an uncertain push result. It also
|
|
116
|
+
// leaves the controls enabled: an operation clicked meanwhile waits for it above, whereas a button
|
|
117
|
+
// that turned disabled under the pointer would swallow the click.
|
|
118
|
+
if (!automatic) setState(previous => ({...previous, busy: true, error: null, notice: undefined}));
|
|
117
119
|
try {
|
|
118
120
|
const update = await operation();
|
|
119
|
-
if (epoch.current === ticket) setState(previous => ({...previous, ...update, busy: false}));
|
|
121
|
+
if (epoch.current === ticket) setState(previous => ({...previous, ...update, busy: automatic ? previous.busy : false}));
|
|
120
122
|
} catch (error) {
|
|
121
123
|
if (epoch.current !== ticket) return;
|
|
122
124
|
const code = error instanceof GitPanelError ? error.code : 'failed';
|
|
123
125
|
// A background read that met another tool still writing tries again on the next check, without an alert.
|
|
124
126
|
if (automatic && code === 'changed') {
|
|
125
127
|
handled.current = null;
|
|
126
|
-
setState(previous => ({...previous, busy: false}));
|
|
127
128
|
return;
|
|
128
129
|
}
|
|
129
130
|
const message = labels[code as keyof typeof labels] || labels.failed;
|
|
130
|
-
setState(previous => ({...previous, error: automatic && previous.error ? previous.error : message,
|
|
131
|
+
setState(previous => ({...previous, error: automatic && previous.error ? previous.error : message,
|
|
132
|
+
busy: automatic ? previous.busy : false, diff: null}));
|
|
131
133
|
} finally {
|
|
132
134
|
running.current = false;
|
|
133
135
|
// A result dropped by a newer load still ends the busy state, unless a refresh follows at once.
|