()
| 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 | |
| 159 | if (!customElements.get('ssr-app')) { |
no outgoing calls
no test coverage detected