Skip to content

Commit

Permalink
chore: remove redundant changesets
Browse files Browse the repository at this point in the history
  • Loading branch information
thijsdaniels committed Aug 13, 2024
1 parent da90b07 commit f031fca
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 12 deletions.
5 changes: 0 additions & 5 deletions .changeset/beige-seahorses-cross.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/sour-berries-change.md

This file was deleted.

8 changes: 6 additions & 2 deletions packages/cdk-next-app/src/constructs/NextApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,21 @@ export class NextApp extends DockerCluster {
return {
directory: source,
secrets: {
npmrc: DockerBuildSecret.fromSrc(path.join(os.homedir(), "/.npmrc")),
npmrc: NextApp.npmSecret(),
},
};
}

return {
...source,
secrets: {
npmrc: DockerBuildSecret.fromSrc(path.join(os.homedir(), "/.npmrc")),
npmrc: NextApp.npmSecret(),
...source.secrets,
},
};
}

protected static npmSecret() {
return DockerBuildSecret.fromSrc(path.join(os.homedir(), ".npmrc"));
}
}
15 changes: 15 additions & 0 deletions packages/react-essentials/hooks/useDelayedValue.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { useEffect, useState } from "react";

export function useDelayedValue<T>(value: T, delay: number) {
const [delayedValue, setDelayedValue] = useState(value);

useEffect(() => {
const timeout = setTimeout(() => {
setDelayedValue(value);
}, delay);

return () => clearTimeout(timeout);
}, [value, delay]);

return delayedValue;
}
44 changes: 44 additions & 0 deletions packages/react-pagination/hooks/useLoadMore.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { useCallback, useEffect, useMemo, useState } from "react";

export interface UseLoadMoreProps<T> {
items: T[];
itemsPerPage: number;
}

/**
* @todo Review this code before releasing it.
* @todo Support asynchoronously fetching more items _instead_ of providing all
* items at once and using `itemsPerPage` to limit the results. These are two
* very different use cases, so evaluate if this hook should support both, or if
* we should create a new hook for the async case.
* @todo Create an additional hook that calls this hook's `loadMore` function
* when the bottom of some overflowing container is reached. The new hook should
* be called `useInfiniteScroll` and should be a thin wrapper around this hook.
* @todo Support setting the initial page.
*/
export function useLoadMore<T>({ items, itemsPerPage }: UseLoadMoreProps<T>) {
const [page, setPage] = useState(1);

const [visibleItems, setVisibleItems] = useState<T[]>(
items.slice(0, itemsPerPage * page),
);

useEffect(() => {
setVisibleItems(items.slice(0, itemsPerPage * page));
}, [page, items, itemsPerPage]);

const isOverflowing = useMemo(
() => items.length > page * itemsPerPage,
[page, items, itemsPerPage],
);

const loadMore = useCallback(() => {
setPage((page) => page + 1);
}, []);

return {
items: visibleItems,
isOverflowing,
loadMore,
};
}

0 comments on commit f031fca

Please sign in to comment.