Skip to content

Commit

Permalink
[client] scroll added requests into view
Browse files Browse the repository at this point in the history
  • Loading branch information
JorisAerts committed Aug 10, 2024
1 parent 8c4e0cd commit b44b2c6
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/client/components/app/RequestSequence/RequestSequence.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ComponentPublicInstance, PropType, VNode } from 'vue'
import { defineComponent, onUpdated, ref, TransitionGroup } from 'vue'
import { defineComponent, ref, TransitionGroup, watch } from 'vue'
import { VList, VListItem } from '../../core'
import { useRequestStore } from '../../../stores/request'
import type { ProxyRequestInfo } from '../../../../shared/Request'
Expand All @@ -22,11 +22,7 @@ export const RequestSequence = defineComponent({
const handleSelect = (item: ProxyRequestInfo) => {
emit('update:modelValue', item)
}
onUpdated(() => {
const el = list.value?.$el
if (!el || !el.$el) return
el.$el.lastChild.scrollIntoView()
})
watch(requestStore.ids, () => list.value?.$el?.lastElementChild?.scrollIntoView())
return () => (
<VList class={['fill-height', 'overflow-auto', 'mt-2']} ref={list}>
<TransitionGroup>
Expand All @@ -49,7 +45,7 @@ export const RequestSequence = defineComponent({
]}
prependIcon={'InputCircle'}
>
<div class={['no-wrap', 'overflow-hidden', 'overflow-ellipsis']}>
<div class={['no-wrap', 'overflow-hidden', 'overflow-ellipsis']} title={`${req.method}${req.url}`}>
{req.method}{req.url}
</div>
</VListItem>
Expand Down

0 comments on commit b44b2c6

Please sign in to comment.