(nuxt) migrate default value of useAsyncData / useFetch

https://nuxt.com/docs/4.x/getting-started/upgrade#default-data-and-error-values-in-useasyncdata-and-usefetch
This commit is contained in:
Valentyne Stigloher 2025-08-01 11:26:09 +02:00
parent a5491ece49
commit 15fc84202e
7 changed files with 8 additions and 8 deletions

View File

@ -2,12 +2,12 @@
import type { SourceRaw, Source } from '~~/shared/classes.ts';
const props = defineProps<{
sources: (SourceRaw | Source)[] | null;
sources: (SourceRaw | Source)[] | undefined;
label: string;
}>();
const publishDates = computed(() => {
if (props.sources === null) {
if (props.sources === undefined) {
return null;
}
const dates: Record<number, number> = {};

View File

@ -8,7 +8,7 @@ const heartbeatHost = runtimeConfig.public.heartbeatLink;
const overall = ref(true);
const activeStats = computed(() => {
if (stats.value === null) {
if (stats.value === undefined) {
return undefined;
}

View File

@ -1,6 +1,6 @@
<script setup lang="ts">
defineProps<{
hash: string | null;
hash: string | undefined;
}>();
const base = 'https://gitlab.com/PronounsPage/PronounsPage/-/commit';

View File

@ -55,7 +55,7 @@ const nounsAsyncData = useAsyncData(
);
const loadNouns = async (): Promise<void> => {
if (nounsAsyncData.data.value === null) {
if (nounsAsyncData.data.value === undefined) {
await nounsAsyncData.execute();
}
};

View File

@ -38,7 +38,7 @@ const pronounGroup = pronounLibrary.find(props.pronoun);
const comprehensive = useComprehensive();
const sourceLibrary = computed(() => {
if (sources.value === null) {
if (sources.value === undefined) {
return null;
}
return new SourceLibrary(config, sources.value);

View File

@ -39,7 +39,7 @@ watch(year, () => {
cells.value.get('1-0')?.focus();
});
const buildTimesheet = (persistent: TimesheetData | null): Timesheet => {
const buildTimesheet = (persistent: TimesheetData | undefined): Timesheet => {
const timesheet: Timesheet = {};
for (let y = min.year; y <= max.year; y++) {
timesheet[y] = {};

View File

@ -23,7 +23,7 @@ const filter = useFilterWithCategory();
const { data: rawSources } = await useFetch('/api/sources', { lazy: true });
const sourceLibrary = computed(() => {
if (rawSources.value === null) {
if (rawSources.value === undefined) {
return undefined;
}
return new SourceLibrary(config, rawSources.value);