MCPcopy Index your code
hub / github.com/streamlit/streamlit / empty

Method empty

frontend/lib/src/render-tree/AppRoot.ts:100–183  ·  view source on GitHub ↗

* Create an empty AppRoot with a placeholder "skeleton" element. * @param mainScriptHash - The hash of the main script that creates this AppRoot. * @param isInitialRender - Whether this is the initial render. * @param sidebarElements - The elements to add to the sidebar (this was a relic

(
    mainScriptHash = "",
    isInitialRender = true,
    sidebarElements?: BlockNode,
    logo?: Logo | null
  )

Source from the content-addressed store, hash-verified

98 * @returns A new AppRoot with the given parameters.
99 */
100 public static empty(
101 mainScriptHash = "",
102 isInitialRender = true,
103 sidebarElements?: BlockNode,
104 logo?: Logo | null
105 ): AppRoot {
106 const mainNodes: AppNode[] = []
107
108 let waitElement: Element | undefined
109
110 switch (getLoadingScreenType()) {
111 case LoadingScreenType.NONE:
112 break
113
114 case LoadingScreenType.V1:
115 // Only show the v1 loading state when it's the initial render.
116 // This is how v1 used to work, and we don't want any backward
117 // incompatibility.
118 if (isInitialRender) {
119 waitElement = makeElementWithInfoText("Please wait...")
120 }
121 break
122
123 default:
124 waitElement = makeAppSkeletonElement()
125 break
126 }
127
128 if (waitElement) {
129 mainNodes.push(
130 new ElementNode(
131 waitElement,
132 ForwardMsgMetadata.create({}),
133 NO_SCRIPT_RUN_ID,
134 mainScriptHash
135 )
136 )
137 }
138
139 const main = new BlockNode(
140 mainScriptHash,
141 mainNodes,
142 new BlockProto({ allowEmpty: true }),
143 NO_SCRIPT_RUN_ID
144 )
145
146 const sidebar =
147 sidebarElements ||
148 new BlockNode(
149 mainScriptHash,
150 [],
151 new BlockProto({ allowEmpty: true }),
152 NO_SCRIPT_RUN_ID
153 )
154
155 const event = new BlockNode(
156 mainScriptHash,
157 [],

Callers 13

AppRoot.test.tsFile · 0.45
destroyMethod · 0.45
useWidgetStateFunction · 0.45
useSelectionHandlerFunction · 0.45
plotting_demoFunction · 0.45
animation_demoFunction · 0.45
constructorMethod · 0.45
constructorMethod · 0.45

Calls 5

getLoadingScreenTypeFunction · 0.90
makeElementWithInfoTextFunction · 0.90
makeAppSkeletonElementFunction · 0.90
pushMethod · 0.45
createMethod · 0.45

Tested by 2

constructorMethod · 0.36
getPropsFunction · 0.36