-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
shadow-cljs #225
base: master
Are you sure you want to change the base?
shadow-cljs #225
Conversation
moduleNamespace = 'module-' + namespace, | ||
|
||
$module = $(this), | ||
$context = $(settings.context), |
Check warning
Code scanning / CodeQL
Unsafe jQuery plugin
moduleNamespace = 'module-' + namespace, | ||
|
||
$module = $(this), | ||
$context = $(settings.context), |
Check warning
Code scanning / CodeQL
Unsafe jQuery plugin
|
||
refresh: function() { | ||
module.verbose('Refreshing selector cache'); | ||
$context = $(settings.context); |
Check warning
Code scanning / CodeQL
Unsafe jQuery plugin
|
||
$module = $(this), | ||
$window = $(window), | ||
$scroll = $(settings.scrollContext), |
Check warning
Code scanning / CodeQL
Unsafe jQuery plugin
Here's an explication what caused this error and later 2 possible solutions (first a bit hacky, second nicer and future proof). The `name-bazaar.ui.core/init` function was called (which in turn emitted the `:district0x/initialize` event (that resulted in the error due to `window.Web3Modal` not being present. It was also called 2 times: first one failed due to the previously mentioned reason. Second one works (because `window.Web3Modal` was there). So why 2 times? First time due to - https://github.com/district0x/name-bazaar/blob/ec1be3a4fbc4529b553b984aad1cda7e55217b71/shadow-cljs.edn#L4 - loaded at https://github.com/district0x/name-bazaar/blob/ec1be3a4fbc4529b553b984aad1cda7e55217b71/resources/public/index.html#L43 Second time due to explicit call of `name_bazaar.ui.core.init()` at https://github.com/district0x/name-bazaar/blob/ec1be3a4fbc4529b553b984aad1cda7e55217b71/resources/public/index.html#L48 The solution? 1. Make sure `web3modal` is loaded before calling `name_bazaar.ui.core.init()` 2. Also: remove the duplicity of calling `name_bazaar.ui.core.init()` twice Solution #1 (hacky): change the order of `<script>` tags so `web3modal` gets loaded before the name bazaar app (and its `ui.core.init` function gets executed. Solution #2 (better): this one doesn't pollute the global object (_window_). Basically loading `web3modal` via CLJS `ns` macro (ns xx `(:require ["web3modal" :as web3modal]))` and setting it up in the code Extra: remove the duplicity Basically removing manual call to https://github.com/district0x/name-bazaar/blob/ec1be3a4fbc4529b553b984aad1cda7e55217b71/resources/public/index.html#L48 and letting the shadow-cljs build execute once it's loaded. Again better because we don't know when `<script>` tag finishes loading
This reverts commit f9fe1e7.
No description provided.