add initialData to queries

This commit is contained in:
daniel31x13
2024-08-01 18:40:08 -04:00
parent 75b1ae738f
commit a73e5fa6c6
35 changed files with 46 additions and 39 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ type Props = {
export default function CollectionCard({ collection, className }: Props) {
const { t } = useTranslation();
const { settings } = useLocalSettingsStore();
const { data: user = [] } = useUser();
const { data: user } = useUser();
const formattedDate = new Date(collection.createdAt as string).toLocaleString(
"en-US",
+2 -2
View File
@@ -25,9 +25,9 @@ interface ExtendedTreeItem extends TreeItem {
const CollectionListing = () => {
const { t } = useTranslation();
const updateCollection = useUpdateCollection();
const { data: collections = [] } = useCollections();
const { data: collections } = useCollections();
const { data: user = [] } = useUser();
const { data: user } = useUser();
const updateUser = useUpdateUser();
const router = useRouter();
@@ -24,7 +24,7 @@ export default function CollectionSelection({
showDefaultValue = true,
creatable = true,
}: Props) {
const { data: collections = [] } = useCollections();
const { data: collections } = useCollections();
const router = useRouter();
+1 -1
View File
@@ -13,7 +13,7 @@ type Props = {
};
export default function TagSelection({ onChange, defaultValue }: Props) {
const { data: tags = [] } = useTags();
const { data: tags } = useTags();
const [options, setOptions] = useState<Options[]>([]);
+2 -2
View File
@@ -34,9 +34,9 @@ export default function LinkCard({ link, flipDropdown, editMode }: Props) {
const { t } = useTranslation();
const viewMode = localStorage.getItem("viewMode") || "card";
const { data: collections = [] } = useCollections();
const { data: collections } = useCollections();
const { data: user = [] } = useUser();
const { data: user } = useUser();
const { links, getLink, setSelectedLinks, selectedLinks } = useLinkStore();
@@ -39,7 +39,7 @@ export default function LinkActions({
const [deleteLinkModal, setDeleteLinkModal] = useState(false);
const [preservedFormatsModal, setPreservedFormatsModal] = useState(false);
const { data: user = [] } = useUser();
const { data: user } = useUser();
const { removeLink, updateLink } = useLinkStore();
+2 -2
View File
@@ -33,9 +33,9 @@ export default function LinkCardCompact({
}: Props) {
const { t } = useTranslation();
const { data: collections = [] } = useCollections();
const { data: collections } = useCollections();
const { data: user = [] } = useUser();
const { data: user } = useUser();
const { links, setSelectedLinks, selectedLinks } = useLinkStore();
useEffect(() => {
+2 -2
View File
@@ -33,8 +33,8 @@ type Props = {
export default function LinkMasonry({ link, flipDropdown, editMode }: Props) {
const { t } = useTranslation();
const { data: collections = [] } = useCollections();
const { data: user = [] } = useUser();
const { data: collections } = useCollections();
const { data: user } = useUser();
const { links, getLink, setSelectedLinks, selectedLinks } = useLinkStore();
@@ -46,7 +46,7 @@ export default function EditCollectionSharingModal({
}
};
const { data: user = [] } = useUser();
const { data: user } = useUser();
const permissions = usePermissions(collection.id as number);
const currentURL = new URL(document.URL);
+1 -1
View File
@@ -43,7 +43,7 @@ export default function NewLinkModal({ onClose }: Props) {
const [submitLoader, setSubmitLoader] = useState(false);
const [optionsExpanded, setOptionsExpanded] = useState(false);
const router = useRouter();
const { data: collections = [] } = useCollections();
const { data: collections } = useCollections();
const setCollection = (e: any) => {
if (e?.__isNew__) e.value = null;
@@ -30,7 +30,7 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) {
const { t } = useTranslation();
const session = useSession();
const { getLink } = useLinkStore();
const { data: user = [] } = useUser();
const { data: user } = useUser();
const [link, setLink] =
useState<LinkIncludingShortenedCollectionAndTags>(activeLink);
const router = useRouter();
+1 -1
View File
@@ -49,7 +49,7 @@ export default function UploadFileModal({ onClose }: Props) {
const [submitLoader, setSubmitLoader] = useState(false);
const [optionsExpanded, setOptionsExpanded] = useState(false);
const router = useRouter();
const { data: collections = [] } = useCollections();
const { data: collections } = useCollections();
const setCollection = (e: any) => {
if (e?.__isNew__) e.value = null;
+1 -1
View File
@@ -9,7 +9,7 @@ import { useUser } from "@/hooks/store/user";
export default function ProfileDropdown() {
const { t } = useTranslation();
const { settings, updateSettings } = useLocalSettingsStore();
const { data: user = [] } = useUser();
const { data: user } = useUser();
const isAdmin = user.id === Number(process.env.NEXT_PUBLIC_ADMIN || 1);
+1 -1
View File
@@ -46,7 +46,7 @@ export default function ReadableView({ link }: Props) {
const router = useRouter();
const { getLink } = useLinkStore();
const { data: collections = [] } = useCollections();
const { data: collections } = useCollections();
const collection = useMemo(() => {
return collections.find(
+2 -2
View File
@@ -22,9 +22,9 @@ export default function Sidebar({ className }: { className?: string }) {
}
);
const { data: collections = [] } = useCollections();
const { data: collections } = useCollections();
const { data: tags = [] } = useTags();
const { data: tags } = useTags();
const [active, setActive] = useState("");
const router = useRouter();