Skip to content

Commit 932730c

Browse files
committed
fix htmx
1 parent 29f9094 commit 932730c

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

web_src/js/features/repo-diff.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,9 @@ function initRepoDiffShowMore() {
196196
const resp = await response.text();
197197
const respDoc = parseDom(resp, 'text/html');
198198
const respFileBody = respDoc.querySelector('#diff-file-boxes .diff-file-body .file-body');
199-
el.parentElement.replaceWith(...Array.from(respFileBody.children));
199+
const respFileBodyChildren = Array.from(respFileBody.children); // respFileBody.children will be empty after replaceWith
200+
el.parentElement.replaceWith(...respFileBodyChildren);
201+
for (const el of respFileBodyChildren) window.htmx.process(el);
200202
// FIXME: calling onShowMoreFiles is not quite right here.
201203
// But since onShowMoreFiles mixes "init diff box" and "init diff body" together,
202204
// so it still needs to call it to make the "ImageDiff" and something similar work.

web_src/js/globals.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ interface Window {
6464
jQuery: typeof import('@types/jquery'),
6565
htmx: Omit<typeof import('htmx.org/dist/htmx.esm.js').default, 'config'> & {
6666
config?: Writable<typeof import('htmx.org').default.config>,
67+
process?: (elt: Element | string) => void,
6768
},
6869
_globalHandlerErrors: Array<ErrorEvent & PromiseRejectionEvent> & {
6970
_inited: boolean,

0 commit comments

Comments
 (0)