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

Method render

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

Source from the content-addressed store, hash-verified

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

Callers 15

index.tsxFile · 0.45
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

Calls

no outgoing calls

Tested by

no test coverage detected