Skip to content
This repository was archived by the owner on Apr 6, 2025. It is now read-only.

Commit ecb12a2

Browse files
committed
remove hack to clear content on empty result, since it didn't work well with client-side-templates extension etc
1 parent 6f56e0a commit ecb12a2

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

dist/sqlite.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Extension to use SQLite database backend for Htmx over:
6161
evt.detail.xhr = {
6262
status: 200,
6363
getAllResponseHeaders: function() {
64-
return this.getResponseHeader("Content-Type:application/json");
64+
return "Content-Type:application/json";
6565
},
6666
getResponseHeader: function(headerName) {
6767
if (headerName.toLowerCase() === "content-type") {
@@ -128,7 +128,7 @@ Extension to use SQLite database backend for Htmx over:
128128
});
129129

130130
evt.detail.xhr.responseJSON = allRows;
131-
evt.detail.xhr.response = allRows.length == 0 ? '' : JSON.stringify(allRows);
131+
evt.detail.xhr.response = JSON.stringify(allRows);
132132
onload();
133133
}
134134
}

dist/sqlite.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "htmx-sqlite",
3-
"version": "1.9.0",
3+
"version": "1.9.1",
44
"description": "Htmx extension to use SQLite database backend over HTTP or OPFS",
55
"author": "Jyri-Matti Lähteenmäki <[email protected]>",
66
"keywords": [

src/sqlite.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Extension to use SQLite database backend for Htmx over:
6161
evt.detail.xhr = {
6262
status: 200,
6363
getAllResponseHeaders: function() {
64-
return this.getResponseHeader("Content-Type:application/json");
64+
return "Content-Type:application/json";
6565
},
6666
getResponseHeader: function(headerName) {
6767
if (headerName.toLowerCase() === "content-type") {
@@ -128,7 +128,7 @@ Extension to use SQLite database backend for Htmx over:
128128
});
129129

130130
evt.detail.xhr.responseJSON = allRows;
131-
evt.detail.xhr.response = allRows.length == 0 ? '' : JSON.stringify(allRows);
131+
evt.detail.xhr.response = JSON.stringify(allRows);
132132
onload();
133133
}
134134
}

test/sqlite.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe("sqlite extension", function() {
2929
it('empty result clears content', function (done) {
3030
var div = make('<div hx-trigger="load" hx-get="SELECT * FROM mytable"></div>');
3131
div.addEventListener('htmx:afterSwap', () => {
32-
div.innerText.should.equal('');
32+
div.innerText.should.equal('[]');
3333
done();
3434
});
3535
});

0 commit comments

Comments
 (0)