mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-04 13:28:25 +00:00 
			
		
		
		
	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>    </details>
This commit is contained in:
		@@ -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;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user