MCPcopy Create free account
hub / github.com/TanStack/query / render

Method render

examples/lit/ssr/src/app.ts:107–156  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

105 }
106
107 protected override render() {
108 if (!this.dataQuery) {
109 return html`
110 <article data-testid="content">
111 <h1>Lit Query SSR</h1>
112 <p data-testid="status">Loading...</p>
113 </article>
114 `
115 }
116
117 const query = this.dataQuery()
118
119 if (query.isPending) {
120 return html`
121 <article data-testid="content">
122 <h1>Lit Query SSR</h1>
123 <p data-testid="status">Loading...</p>
124 </article>
125 `
126 }
127
128 if (query.isError) {
129 return html`
130 <article data-testid="content">
131 <h1>Lit Query SSR</h1>
132 <p data-testid="status">Error</p>
133 <p data-testid="error-message">${query.error?.message}</p>
134 </article>
135 `
136 }
137
138 return html`
139 <article data-testid="content">
140 <h1>Lit Query SSR</h1>
141 <p data-testid="status">${query.isFetching ? 'Refreshing' : 'Ready'}</p>
142 <p data-testid="message">${query.data.message}</p>
143 <p data-testid="request-count">
144 Request count: ${query.data.requestCount}
145 </p>
146 <p data-testid="served-at">Served at: ${query.data.servedAt}</p>
147 <button
148 data-testid="refetch-button"
149 ?disabled=${query.isFetching}
150 @click=${this.handleRefetch}
151 >
152 Refetch
153 </button>
154 </article>
155 `
156 }
157}
158
159if (!customElements.get('ssr-app')) {

Callers 15

index.tsxFile · 0.45
main.tsxFile · 0.45
index.tsxFile · 0.45
index.tsxFile · 0.45
index.tsxFile · 0.45
index.tsxFile · 0.45
index.tsxFile · 0.45
index.tsxFile · 0.45
index.tsxFile · 0.45
index.tsxFile · 0.45
index.tsxFile · 0.45
index.tsxFile · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected