diff --git a/HACKS.md b/HACKS.md index e3dd2904..d9747919 100644 --- a/HACKS.md +++ b/HACKS.md @@ -1,5 +1,2 @@ - @cycle/history had to be patched (via patch-package) to properly handle `` -- search form submissions were not properly caught by cyclejs's dom driver, had to be - worked around with a hack using rxjs directly. - diff --git a/client/npm-shrinkwrap.json b/client/npm-shrinkwrap.json index 1e6cbbb3..a8e3c187 100644 --- a/client/npm-shrinkwrap.json +++ b/client/npm-shrinkwrap.json @@ -100,25 +100,14 @@ } }, "@cycle/dom": { - "version": "22.4.0", - "resolved": "https://registry.npmjs.org/@cycle/dom/-/dom-22.4.0.tgz", - "integrity": "sha512-tJQA+i+iK4L2Z0wy+bVTE3agsq1xAuGK2TjKalb51bIP5lHxffoFFb+RYAxwwcLDPxejruSSVUcg3GQn8lp7Lw==", + "version": "22.6.0", + "resolved": "https://registry.npmjs.org/@cycle/dom/-/dom-22.6.0.tgz", + "integrity": "sha512-87hg0nzpQf7ofSQ66eF4qMpLyx099sqCO8C57BQy6lZeczsNBvmZCcXsOkJP1Eca5euJnMwe9jxFez3F4Tep5Q==", "requires": { "@cycle/run": "^5.2.0", - "snabbdom": "^0.7.2", + "snabbdom": "^0.7.4", "snabbdom-selector": "^4.2.0", "xstream": "*" - }, - "dependencies": { - "@cycle/run": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/@cycle/run/-/run-5.3.0.tgz", - "integrity": "sha512-rAkDrfireTCakTrH6AQZvRw6PhXjbkJVWrKPiaC2sPCvWW/rX2jtMwgM1qO8ipROBxwAOTyq3zEIlEQiRa+qbg==", - "requires": { - "quicktask": "1.1.0", - "xstream": "10.x || 11.x" - } - } } }, "@cycle/history": { @@ -1133,9 +1122,9 @@ } }, "snabbdom": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/snabbdom/-/snabbdom-0.7.3.tgz", - "integrity": "sha512-XNh90GQiV36hWdfSL46fIVrSSvmBuZlWk3++qaEgBeQWQJCqTphcbjTODPv8/vyZHJaB3VhePsWfGxi/zBxXyw==" + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/snabbdom/-/snabbdom-0.7.4.tgz", + "integrity": "sha512-nnN+7uZ2NTIiu7EPMNwSDhmrYXqwlfCP/j72RdzvDPujXyvQxOW7Jl9yuLayzxMHDNWQR7FM6Pcn4wnDpKRe6Q==" }, "snabbdom-pragma": { "version": "2.8.0", diff --git a/client/package.json b/client/package.json index 06d3988e..a65c3624 100644 --- a/client/package.json +++ b/client/package.json @@ -10,7 +10,7 @@ "dependencies": { "@babel/plugin-transform-react-jsx": "^7.9.1", "@babel/polyfill": "^7.8.7", - "@cycle/dom": "^22.4.0", + "@cycle/dom": "^22.6.0", "@cycle/history": "^7.4.0", "@cycle/html": "^3.3.0", "@cycle/http": "^15.3.0", diff --git a/client/src/app.js b/client/src/app.js index 0a773a28..07272028 100644 --- a/client/src/app.js +++ b/client/src/app.js @@ -18,11 +18,6 @@ const apiBase = (process.env.API_URL || '/api').replace(/\/+$/, '') const reservedPaths = [ 'mempool', 'assets' ] -// Temporary bug workaround. Listening with on('form.search', 'submit') was unable -// to catch some form submissions. -const searchSubmit$ = !process.browser ? O.empty() : O.fromEvent(document.body, 'submit') - .filter(e => e.target.classList.contains('search')) - // Make driver source observables rxjs5-compatible via rxjs-compat setAdapt(stream => O.from(stream)) @@ -59,6 +54,8 @@ export default function main({ DOM, HTTP, route, storage, scanner: scan$, search , goAssetList$ = !process.env.ISSUED_ASSETS || !process.env.ASSET_MAP_URL ? O.empty() : route('/assets') + , searchSubmit$ = on('.search', 'submit').map(e => e.target.querySelector('[name=q]').value) + // auto-expand when opening with "#expand" , expandTx$ = route('/tx/:txid').filter(loc => loc.query.expand).map(loc => loc.params.txid) , expandBl$ = route('/block/:hash').filter(loc => loc.query.expand).map(loc => loc.params.hash) @@ -68,7 +65,7 @@ export default function main({ DOM, HTTP, route, storage, scanner: scan$, search , togTheme$ = click('.toggle-theme') , copy$ = click('[data-clipboard-copy]').map(d => d.clipboardCopy) - , query$ = O.merge(searchSubmit$.map(e => e.target.querySelector('[name=q]').value), goSearch$) + , query$ = O.merge(searchSubmit$, goSearch$) , pushtx$ = (process.browser ? on('form[data-do=pushtx]', 'submit', { preventDefault: true }).map(e => e.ownerTarget.querySelector('[name=tx]').value) : goPush$.filter(loc => loc.body && loc.body.tx).map(loc => loc.body.tx) @@ -361,8 +358,6 @@ export default function main({ DOM, HTTP, route, storage, scanner: scan$, search // @XXX side-effects outside of drivers if (process.browser) { - searchSubmit$.subscribe(e => e.preventDefault()) - // Click-to-copy if (navigator.clipboard) copy$.subscribe(text => navigator.clipboard.writeText(text))