Sfoglia il codice sorgente

chore: add tip about Suspense being experimental

Evan You 6 anni fa
parent
commit
ca84f46cd0
1 ha cambiato i file con 10 aggiunte e 0 eliminazioni
  1. 10 0
      packages/runtime-core/src/components/Suspense.ts

+ 10 - 0
packages/runtime-core/src/components/Suspense.ts

@@ -227,6 +227,8 @@ export interface SuspenseBoundary {
   unmount(parentSuspense: SuspenseBoundary | null, doRemove?: boolean): void
 }
 
+let hasWarned = false
+
 function createSuspenseBoundary(
   vnode: VNode,
   parent: SuspenseBoundary | null,
@@ -239,6 +241,14 @@ function createSuspenseBoundary(
   rendererInternals: RendererInternals,
   isHydrating = false
 ): SuspenseBoundary {
+  /* istanbul ignore if */
+  if (__DEV__ && !__TEST__ && !hasWarned) {
+    hasWarned = true
+    console[console.info ? 'info' : 'log'](
+      `<Suspense> is an experimental feature and its API will likely change.`
+    )
+  }
+
   const {
     p: patch,
     m: move,