Skip to content

Commit 605a5ce

Browse files
committed
feat(mr): activity loading.
1 parent d775cfb commit 605a5ce

File tree

7 files changed

+10
-9
lines changed

7 files changed

+10
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "coding-plugin",
33
"description": "Coding plugin for VS Code.",
4-
"version": "1.0.0",
4+
"version": "0.1.0",
55
"publisher": "coding",
66
"license": "MIT",
77
"engines": {

src/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export async function activate(context: vscode.ExtensionContext) {
6464
Panel.currentPanel?.broadcast(`mr.reviewers.init`, reviewerResp.data);
6565
});
6666
codingSrv.getMRComments(mr.iid).then((commentResp) => {
67-
Panel.currentPanel?.broadcast(`mr.udpate.comments`, commentResp.data);
67+
Panel.currentPanel?.broadcast(`mr.update.comments`, commentResp.data);
6868
});
6969
}),
7070
);

webviews/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import appStore from 'webviews/store/appStore';
55
import persistDataHook from 'webviews/hooks/persistDataHook';
66
import Activities from 'webviews/components/Activities';
77
import Reviewers from 'webviews/components/Reviewers';
8-
import messageTransferHook from 'webviews/hooks/messageTransferHook';
8+
import initDataHook from 'webviews/hooks/initDataHook';
99
import EditButton from 'webviews/components/EditButton';
1010
// import { requestUpdateMRContent } from 'webviews/service/mrService';
1111

@@ -35,7 +35,7 @@ function App() {
3535
const { merge_request: mergeRequest } = data || {};
3636

3737
persistDataHook();
38-
messageTransferHook();
38+
initDataHook();
3939

4040
const handleKeyDown = async (event: any) => {
4141
if (event.key === 'Enter') {

webviews/components/Activities.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ function Activities() {
3434
(a, b) => a[0]?.created_at - b[0]?.created_at,
3535
);
3636

37+
if (!allActivities.length) {
38+
return <div>Loading...</div>;
39+
}
40+
3741
return (
3842
<div>
3943
<div>

webviews/hooks/messageTransferHook.tsx renamed to webviews/hooks/initDataHook.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useEffect } from 'react';
22
import appStore from 'webviews/store/appStore';
33
import { actions } from 'webviews/store/constants';
44

5-
export default function messageTransferHook() {
5+
export default function initDataHook() {
66
useEffect(() => {
77
window.addEventListener('message', (ev) => {
88
const { updateCurrentMR, toggleMRLoading, initMRReviewers, initMRActivities } = appStore;

webviews/store/appStore.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ const appStore = store({
2020
updateMRActivities(data: IActivity[]) {
2121
appStore.activities = data;
2222
},
23-
updateMRReviewers(data: IMRReviewers) {
24-
appStore.reviewers = data;
25-
},
2623
updateMRComments(data: IComment[]) {
2724
appStore.comments = data;
2825
},

webviews/store/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export enum actions {
55
MR_DISAPPROVE = `mr.disapprove`,
66
MR_MERGE = `mr.merge`,
77
MR_UPDATE_TITLE = `mr.update.title`,
8-
MR_UPDATE_COMMENTS = `mr.udpate.comments`,
8+
MR_UPDATE_COMMENTS = `mr.update.comments`,
99
MR_ADD_COMMENT = `mr.add.comment`,
1010
MR_GET_ACTIVITIES = `mr.get.activities`,
1111
MR_TOGGLE_LOADING = `mr.update.toggleLoading`,

0 commit comments

Comments
 (0)