Skip to content

Commit 6ae7419

Browse files
committedNov 29, 2024··
feat: don't timeout icon load on client, only on ssr
The timeout was introduced mainly to not have the SSR hanging forever. At the client side, sometime due to the network conditions, the timeout become a footgun that failed to render the icon even the data is eventually received. This PR changes that to have `fetchTimeout` only effective at SSR. This also align more between the CSS and SSR modes.
1 parent 1381039 commit 6ae7419

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed
 

‎src/runtime/components/css.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export const NuxtIconCss = /* @__PURE__ */ defineComponent({
144144
mountCSS(data)
145145
}
146146
else {
147-
loadIcon(props.name, options.fetchTimeout)
147+
loadIcon(props.name, import.meta.server ? options.fetchTimeout : -1)
148148
.then((data) => {
149149
if (data)
150150
mountCSS(data)

‎src/schema-types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export interface NuxtIconRuntimeOptions {
133133
/**
134134
* Fetch Timeout
135135
*
136-
* Set the timeout for fetching icons.
136+
* Set the timeout for fetching icons on SSR.
137137
*
138138
* @default 1500
139139
*/

0 commit comments

Comments
 (0)
Please sign in to comment.