mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 02:46:04 +01:00 
			
		
		
		
	Use shallowRef instead of ref in .vue files where possible (#34813)
				
					
				
			This PR improves some `.vue` components by using `shallowRef instead of ref`, which `should improve performance`. It's probably not significant, but it's an improvement because Vue no longer deep watches the ref (shallowRef). Also i used `useTemplateRef` instead of `ref`. --------- Signed-off-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
		| @@ -1,7 +1,7 @@ | ||||
| <script lang="ts" setup> | ||||
| import {SvgIcon} from '../svg.ts'; | ||||
| import {isPlainClick} from '../utils/dom.ts'; | ||||
| import {ref} from 'vue'; | ||||
| import {shallowRef} from 'vue'; | ||||
| import {type createViewFileTreeStore} from './ViewFileTreeStore.ts'; | ||||
|  | ||||
| type Item = { | ||||
| @@ -20,9 +20,9 @@ const props = defineProps<{ | ||||
| }>(); | ||||
|  | ||||
| const store = props.store; | ||||
| const isLoading = ref(false); | ||||
| const children = ref(props.item.children); | ||||
| const collapsed = ref(!props.item.children); | ||||
| const isLoading = shallowRef(false); | ||||
| const children = shallowRef(props.item.children); | ||||
| const collapsed = shallowRef(!props.item.children); | ||||
|  | ||||
| const doLoadChildren = async () => { | ||||
|   collapsed.value = !collapsed.value; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user