Skip to content

Commit

Permalink
devop: cleanup scroll position
Browse files Browse the repository at this point in the history
  • Loading branch information
olgakup committed Jan 3, 2025
1 parent 0bbab42 commit 5b36317
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

<script setup lang="ts">
import { NodeType } from '@/types/provider';
import { PropType, ref, watch, onMounted, nextTick } from 'vue';
import { PropType, ref, watch, onMounted, nextTick, onUnmounted } from 'vue';
import TestNetworkIcon from '@action/icons/common/test-network-icon.vue';
import NewIcon from '@action/icons/asset/new-icon.vue';
import PinIcon from '@action/icons/actions/pin.vue';
Expand Down Expand Up @@ -70,6 +70,7 @@ const props = defineProps({
canDrag: {
type: Boolean,
required: false,
default: false,
},
newNetworkTags: {
type: Object as PropType<{ networks: string[]; swap: string[] }>,
Expand Down Expand Up @@ -183,6 +184,7 @@ const isStickyTop = ref<boolean | undefined>(undefined);
* It calculates the position based on the scroll position, direction and the offset.
*/
const getPosition = () => {
if (!target.value) return;
const height = target.value?.offsetHeight || 0;
const offset = -height;
const anchorTop = (target.value?.offsetTop || 0) + offset;
Expand Down Expand Up @@ -215,6 +217,11 @@ watch(
}
},
);
onUnmounted(() => {
// Clear any cached values or listeners
isStickyTop.value = undefined;
});
</script>

<style lang="less">
Expand Down

0 comments on commit 5b36317

Please sign in to comment.