refactor(collection): useCollectionView + view (Brief 3) #88
2 changed files with 3 additions and 4 deletions
|
|
@ -6,7 +6,7 @@ import { downloadCollectionCardsCsv } from './collection-cards-csv.js';
|
||||||
/**
|
/**
|
||||||
* Card/collection page state and handlers (god-component split).
|
* Card/collection page state and handlers (god-component split).
|
||||||
*/
|
*/
|
||||||
export function useCollectionView() {
|
export function useCollectionView({ user = null, authLoading = true } = {}) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { identifier } = router.query;
|
const { identifier } = router.query;
|
||||||
|
|
||||||
|
|
@ -435,7 +435,7 @@ export function useCollectionView() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const showInitialLoading = loading;
|
const showInitialLoading = authLoading || loading;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
cards,
|
cards,
|
||||||
|
|
@ -456,7 +456,6 @@ export function useCollectionView() {
|
||||||
handleSearchCards,
|
handleSearchCards,
|
||||||
handleToggleFavorite,
|
handleToggleFavorite,
|
||||||
handleToggleSelect,
|
handleToggleSelect,
|
||||||
id,
|
|
||||||
identifier,
|
identifier,
|
||||||
isFavorited,
|
isFavorited,
|
||||||
loading,
|
loading,
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import { useCollectionView } from '../../lib/use-collection-view.js';
|
||||||
|
|
||||||
export default function CollectionView() {
|
export default function CollectionView() {
|
||||||
const { user, loading: authLoading } = useAuth();
|
const { user, loading: authLoading } = useAuth();
|
||||||
const collectionPage = useCollectionView();
|
const collectionPage = useCollectionView({ user, authLoading });
|
||||||
|
|
||||||
if (collectionPage.showInitialLoading) {
|
if (collectionPage.showInitialLoading) {
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue