Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(#1575) - Auto scroll on collection run update #1577

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions packages/bruno-app/src/components/RunnerResults/index.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useEffect } from 'react';
import React, { useState, useRef, useEffect } from 'react';
import path from 'path';
import { useDispatch } from 'react-redux';
import { get, cloneDeep } from 'lodash';
Expand All @@ -22,6 +22,7 @@ const getRelativePath = (fullPath, pathname) => {

export default function RunnerResults({ collection }) {
const dispatch = useDispatch();
const listWrapperRef = useRef();
const [selectedItem, setSelectedItem] = useState(null);

useEffect(() => {
Expand Down Expand Up @@ -66,6 +67,11 @@ export default function RunnerResults({ collection }) {
})
.filter(Boolean);

useEffect(() => {
if (listWrapperRef.current) {
listWrapperRef.current.scrollIntoView({ behavior: 'smooth', block: 'end', inline: 'nearest' });
}
}, [items]);
const runCollection = () => {
dispatch(runCollectionFolder(collection.uid, null, true));
};
Expand Down Expand Up @@ -118,7 +124,7 @@ export default function RunnerResults({ collection }) {
}

return (
<StyledWrapper className="px-4 pb-4 flex flex-grow flex-col relative">
<StyledWrapper ref={listWrapperRef} className="px-4 pb-4 flex flex-grow flex-col relative">
<div className="flex flex-row mt-6 mb-4">
<div className="font-medium title flex items-center">
Runner
Expand Down
Loading