Commit 0101a09d authored by Lyza Danger Gardner's avatar Lyza Danger Gardner Committed by Lyza Gardner

Alter `ThreadList` to take an Array of `Thread` objects

parent 060e48fa
......@@ -88,7 +88,7 @@ function AnnotationView({ loadAnnotationsService, onLogin }) {
// for this scenario as well.
<SidebarContentError errorType="annotation" onLoginRequest={onLogin} />
)}
<ThreadList thread={rootThread} />
<ThreadList threads={rootThread.children} />
</>
);
}
......
......@@ -51,7 +51,7 @@ function NotebookView({ loadAnnotationsService }) {
<NotebookResultCount />
</div>
<div className="NotebookView__items">
<ThreadList thread={rootThread} />
<ThreadList threads={rootThread.children} />
</div>
</div>
);
......
......@@ -152,7 +152,7 @@ function SidebarView({
<SidebarContentError errorType="group" onLoginRequest={onLogin} />
)}
{showTabs && <SelectionTabs isLoading={isLoading} />}
<ThreadList thread={rootThread} />
<ThreadList threads={rootThread.children} />
{showLoggedOutMessage && <LoggedOutMessage onLogin={onLogin} />}
</div>
);
......
......@@ -64,7 +64,7 @@ function StreamView({ api, toastMessenger }) {
const rootThread = useRootThread();
return <ThreadList thread={rootThread} />;
return <ThreadList threads={rootThread.children} />;
}
StreamView.propTypes = {
......
......@@ -33,7 +33,7 @@ function roundScrollPosition(pos) {
/**
* @typedef ThreadListProps
* @prop {Thread} thread
* @prop {Thread[]} threads
*/
/**
......@@ -47,7 +47,7 @@ function roundScrollPosition(pos) {
*
* @param {ThreadListProps} props
*/
function ThreadList({ thread }) {
function ThreadList({ threads }) {
// Height of the visible area of the scroll container.
const [scrollContainerHeight, setScrollContainerHeight] = useState(
window.innerHeight
......@@ -74,7 +74,7 @@ function ThreadList({ thread }) {
/** @type {string|null} */ (null)
);
const topLevelThreads = thread.children;
const topLevelThreads = threads;
const {
offscreenLowerHeight,
......@@ -210,7 +210,7 @@ function ThreadList({ thread }) {
ThreadList.propTypes = {
/** Should annotations render extra document metadata? */
thread: propTypes.object.isRequired,
threads: propTypes.array.isRequired,
};
export default ThreadList;
......@@ -17,9 +17,12 @@ describe('ThreadList', () => {
let wrappers;
function createComponent(props) {
const wrapper = mount(<ThreadList thread={fakeTopThread} {...props} />, {
const wrapper = mount(
<ThreadList threads={fakeTopThread.children} {...props} />,
{
attachTo: fakeScrollContainer,
});
}
);
wrappers.push(wrapper);
return wrapper;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment