Skip to content

Commit

Permalink
fix: list component fixed (#162)
Browse files Browse the repository at this point in the history
* fix: list component fixed

* style: ran prettier

* Update List.tsx

* refactor: remove console log

---------

Co-authored-by: Razboy20 <razboy20@gmail.com>
  • Loading branch information
knownotunknown and Razboy20 authored Mar 14, 2024
1 parent e919e96 commit 5714ed1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default function CalendarHeader(): JSX.Element {

return (
<div className='min-h-79px min-w-672px w-full flex px-0 py-5'>
<div className='flex flex-row gap-20 w-full'>
<div className='w-full flex flex-row gap-20'>
<div className='flex gap-10'>
<div className='flex gap-1'>
<Button className='self-center' variant='single' icon={MenuIcon} color='ut-gray' />
Expand All @@ -57,7 +57,7 @@ export default function CalendarHeader(): JSX.Element {
</Text>
</div>
</div>
<div className='flex flex-row items-center justify-end space-x-8 ml-auto'>
<div className='ml-auto flex flex-row items-center justify-end space-x-8'>
<div className='flex flex-row space-x-4'>
<CourseStatus size='small' status={Status.WAITLISTED} />
<CourseStatus size='small' status={Status.CLOSED} />
Expand Down
9 changes: 4 additions & 5 deletions src/views/components/common/List/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,12 @@ function List<T>(props: ListProps<T>): JSX.Element {

useEffect(() => {
// check if the draggables content has *actually* changed
if (props.draggables.every((element, index) => equalityCheck(element, items[index].content))) {
console.log("List's draggables have not changed");
if (
props.draggables.length === items.length &&
props.draggables.every((element, index) => equalityCheck(element, items[index].content))
) {
return;
}

console.log("List's draggables have changed, updating...");

setItems(wrap(props.draggables));
}, [props.draggables]);

Expand Down

0 comments on commit 5714ed1

Please sign in to comment.