Skip to content

Commit d985cef

Browse files
committed
[nop] Clean up workaround for #247
1 parent 446be84 commit d985cef

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

src/taoensso/sente.cljc

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,9 +1160,8 @@
11601160

11611161
#?(:clj
11621162
(defmacro ^:private elide-require
1163-
"Experimental. The presence of `js/require` calls can cause issues with
1164-
React Native, even if they never execute. Currently no other known
1165-
workarounds. Ref. https://github.com/ptaoussanis/sente/issues/247."
1163+
"`js/require` calls can cause issues with React Native static analysis even
1164+
if they never execute, Ref. <https://github.com/ptaoussanis/sente/issues/247>."
11661165
[& body]
11671166
(when-not (enc/get-env {:as :bool} :sente-elide-js-require)
11681167
`(do ~@body))))
@@ -1174,23 +1173,14 @@
11741173
1. Add the lein-npm[2] plugin to your `project.clj`,
11751174
2. Add: `:npm {:dependencies [[websocket \"1.0.23\"]]}`
11761175
1177-
[1] Ref. https://www.npmjs.com/package/websocket
1178-
[2] Ref. https://github.com/RyanMcG/lein-npm"
1176+
[1] Ref. <https://www.npmjs.com/package/websocket>
1177+
[2] Ref. <https://github.com/RyanMcG/lein-npm>"
11791178

1180-
;; This `let` silliness intended to work around React Native's
1181-
;; static analysis tool, to prevent it from detecting a
1182-
;; missing package.
1183-
;;
1184-
;; Ref. https://github.com/ptaoussanis/sente/issues/247#issuecomment-555219121
1185-
;;
11861179
(let [make-package-name (fn [prefix] (str prefix "socket"))
1187-
require-fn
1188-
(if (exists? js/require)
1189-
js/require
1190-
(constantly :no-op))]
1180+
require-fn (if (exists? js/require) js/require (constantly :no-op))]
11911181

1192-
(delay ; Eager eval causes issues with React Native, Ref. #247,
1193-
(elide-require ; TODO is this now safe to remove?
1182+
(delay ; For React Native, Ref. #247
1183+
(elide-require ; For React Native, Ref. #247
11941184
(when (and node-target? (exists? js/require))
11951185
(try
11961186
(require-fn (make-package-name "web"))

0 commit comments

Comments
 (0)