feat: display uncommit&unpush change - [INS-4138]#7816
Merged
CurryYangxx merged 10 commits intodevelopfrom Aug 12, 2024
Merged
Conversation
119e9cb to
0854418
Compare
Member
4e4411f to
c04c7f3
Compare
Member
Author
|
updated |
gatzjames
reviewed
Aug 8, 2024
| const { canPush } = gitCanPushFetcher.data; | ||
| const { changes } = gitChangesFetcher.data; | ||
| // update workspace meta with git sync data, use for show unpushed changes on collection card | ||
| models.workspaceMeta.updateByParentId(workspaceId, { |
Contributor
There was a problem hiding this comment.
I think this should go to the loaders/actions that it relies upon.
My thinking:
- We want to move db calls out of the UI in general
- It's going to remove an extra useEffect
Member
Author
There was a problem hiding this comment.
Move them to the loaders&actions.
FYI: I removed syncData and put hasUncommittedChanges and hasUnpushedChanges directly on the first level. Because the db update will not deep merge an object.
gatzjames
reviewed
Aug 8, 2024
Comment on lines
+342
to
+348
| // update workspace meta with sync data, use for show unpushed changes on collection card | ||
| models.workspaceMeta.updateByParentId(workspaceId, { | ||
| syncData: { | ||
| hasUncommittedChanges: Object.keys(status?.unstaged || {}).length > 0 || Object.keys(status?.stage || {}).length > 0, | ||
| hasUnpushedChanges: compare?.ahead > 0, | ||
| }, | ||
| }); |
Contributor
There was a problem hiding this comment.
Thinking this is simpler to understand. What do you think? Feel free to add/dismiss this one:
Suggested change
| // update workspace meta with sync data, use for show unpushed changes on collection card | |
| models.workspaceMeta.updateByParentId(workspaceId, { | |
| syncData: { | |
| hasUncommittedChanges: Object.keys(status?.unstaged || {}).length > 0 || Object.keys(status?.stage || {}).length > 0, | |
| hasUnpushedChanges: compare?.ahead > 0, | |
| }, | |
| }); | |
| let hasUncommittedChanges = false; | |
| if (status?.unstaged && Object.keys(status.unstaged).length > 0) { | |
| hasUncommittedChanges = true; | |
| } | |
| if (status?.stage && Object.keys(stage).length > 0) { | |
| hasUncommittedChanges = true; | |
| } | |
| // update workspace meta with sync data, use for show unpushed changes on collection card | |
| models.workspaceMeta.updateByParentId(workspaceId, { | |
| syncData: { | |
| hasUncommittedChanges, | |
| hasUnpushedChanges: compare?.ahead > 0, | |
| }, | |
| }); |
Member
Author
There was a problem hiding this comment.
Good advice. I agree with you👍
c94d763 to
03b9eea
Compare
gatzjames
reviewed
Aug 12, 2024
26599c5 to
e96e235
Compare
gatzjames
approved these changes
Aug 12, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Feature: Show uncommitted & unpushed change for both insomnia sync and git sync
Currently this pr can only show unpush/uncommit status for active project
Changes:
hasUnpushedChangesandhasUncommittedChangesto the workspace meta modelcan-pushloader to check if there are unpushed changesNext step: