-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor diffFileInfo / DiffTreeStore (#24998)
Follow #21012, #22399 Replace #24983, fix #24938 Help #24956 Now, the `window.config.pageData.diffFileInfo` itself is a reactive store, so it's quite easy to sync values/states by it, no need to do "doLoadMoreFiles" or "callback". Screenshot: these two buttons both work. After complete loading, the UI is also right. <details> ![image](https://github.com/go-gitea/gitea/assets/2114189/cc6310fd-7f27-45ea-ab4f-24952a87b421) ![image](https://github.com/go-gitea/gitea/assets/2114189/4c11dd67-ac03-4568-8541-91204d27a4e3) ![image](https://github.com/go-gitea/gitea/assets/2114189/38a22cec-41be-41e6-a209-f347b7a4c1de) </details>
- Loading branch information
1 parent
32185ef
commit ee99cf6
Showing
6 changed files
with
76 additions
and
100 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
import {reactive} from 'vue'; | ||
|
||
export const DiffTreeStore = reactive({ | ||
selectedItem: '', | ||
}); | ||
let diffTreeStoreReactive; | ||
export function diffTreeStore() { | ||
if (!diffTreeStoreReactive) { | ||
diffTreeStoreReactive = reactive(window.config.pageData.diffFileInfo); | ||
window.config.pageData.diffFileInfo = diffTreeStoreReactive; | ||
} | ||
return diffTreeStoreReactive; | ||
} |