Workiva / over_react

A library for building statically-typed React UI components using Dart.
Other
427 stars 58 forks source link

possible bug with Redux dev tools middleware #939

Open dave-doty opened 1 week ago

dave-doty commented 1 week ago
  • Issue Type: BUG (maybe? or I'm doing something wrong)
  • over_react Version(s): 5.3.0
  • dart version: 2.19.6
  • Chrome version: 128.0.6613.120 (Official Build) (64-bit)

Describe your issue here... _If it is a bug - PLEASE follow our bug submission guidelines._

(Sorry, the link https://github.com/Workiva/over_react/blob/master/.github/CONTRIBUTING.md#bug-reports is broken, and https://github.com/Workiva/over_react/blob/master/CONTRIBUTING.md doesn't say much about bug reports.)

When I load my app using OverReact and Redux, I see this on startup:

image

and I'm unable to use Redux dev tools (I assume because of the above error):

image

Here's the full text and stack trace:

dart_env_dev.js:26 OverReactReduxDevToolsMiddleware [WARNING]: Unknown event from @devtools-extension: OPTIONS. Ignoring {type: 'OPTIONS', options: {…}, id: undefined, source: '@devtools-extension'}id: undefinedoptions: {allowlist: '', blacklist: '', denylist: '', editor: '', filter: 'DO_NOT_FILTER', …}allowlist: ""blacklist: ""denylist: ""editor: ""filter: "DO_NOT_FILTER"inject: truemaxAge: 50projectPath: ""shouldCatchErrors: falseshowContextMenus: trueurls: "^https?://localhost|0\\.0\\.0\\.0:\\d+\n^https?://.+\\.github\\.io"useEditor: 0whitelist: ""Symbol(dartx.hashCode): (...)Symbol(dartx.runtimeType): (...)[[Prototype]]: Objectsource: "@devtools-extension"type: "OPTIONS"Symbol(dartx.hashCode): (...)Symbol(dartx.runtimeType): (...)[[Prototype]]: Object
(anonymous) @ dart_env_dev.js:26
overrideMethod @ console.js:288
callMethod$ @ js_util_patch.dart:81
(anonymous) @ middleware.dart:48
runUnaryGuarded @ zone.dart:1593
[_sendData] @ stream_impl.dart:339
[_add] @ stream_impl.dart:271
[_sendData] @ broadcast_stream_controller.dart:377
add @ broadcast_stream_controller.dart:244
[_publish] @ logger.dart:309
log @ logger.dart:233
warning @ logger.dart:284
handleEventFromRemote @ middleware.dart:152
_checkAndCall @ operations.dart:367
dcall @ operations.dart:372
ret @ js_patch.dart:414
(anonymous) @ page.bundle.js:6
(anonymous) @ page.bundle.js:6
(anonymous) @ page.bundle.js:6
Ce @ page.bundle.js:6
postMessage
c @ content.bundle.js:3
(anonymous) @ content.bundle.js:3
g @ content.bundle.js:1
F @ content.bundle.js:3
w @ content.bundle.js:3
b @ content.bundle.js:3
postMessage
M @ page.bundle.js:4
bt @ page.bundle.js:6
middleware._OverReactReduxDevToolsMiddleware.new @ middleware.dart:60
overReactReduxDevToolsMiddlewareFactory @ middleware.dart:222
initialize_state @ app.dart:125
start @ app.dart:95
runBody @ async_patch.dart:84
_async @ async_patch.dart:123
start @ app.dart:88
main$ @ main.dart:7
(anonymous) @ main.dart.bootstrap.js:366
window.$dartRunMain @ main.dart.bootstrap.js:365
(anonymous) @ VM446:1
runMain @ client.js:8803
(anonymous) @ client.js:24896
(anonymous) @ client.js:3448
call$2 @ client.js:11507
_asyncStartSync @ client.js:3412
$call$body$main__closure @ client.js:24912
call$1 @ client.js:24824
_rootRunUnary @ client.js:3816
runUnary$2$2 @ client.js:12906
runUnaryGuarded$1$2 @ client.js:12853
_sendData$1 @ client.js:12446
perform$1 @ client.js:12629
call$0 @ client.js:12688
_microtaskLoop @ client.js:3656
_startMicrotaskLoop @ client.js:3662
call$1 @ client.js:11384
invokeClosure @ client.js:1227
(anonymous) @ client.js:1246
childList
call$1 @ client.js:11394
_scheduleAsyncCallback @ client.js:3676
_rootScheduleMicrotask @ client.js:3863
scheduleMicrotask @ client.js:3705
schedule$1 @ client.js:12660
_addPending$1 @ client.js:12437
_sendData$1 @ client.js:12250
add$1 @ client.js:12116
_onIncomingMessage$1 @ client.js:24096
(anonymous) @ client.js:1337
invokeClosure @ client.js:1227
(anonymous) @ client.js:1246
Show 7 more frames
Show less
tacoxdna_worker.js:1 Uncaught ReferenceError: importScripts is not defined
    at tacoxdna_worker.js:1:1
(anonymous) @ tacoxdna_worker.js:1
metro.min.js:7 Metro 4 - v4.5.1. Built at: 01/09/2022 18:29:28
metro.min.js:7 m4q - v1.1.0. Built at 05/05/2021 22:47:56
UI.js:363 Notification: Finished indexing!
io.js:247 1 't =' 0
dart_env_dev.js:26 OverReactReduxDevToolsMiddleware [WARNING]: Unknown event from @devtools-extension: STOP. Ignoring {type: 'STOP', failed: true, source: '@devtools-extension'}
(anonymous) @ dart_env_dev.js:26
overrideMethod @ console.js:288
callMethod$ @ js_util_patch.dart:81
(anonymous) @ middleware.dart:48
runUnaryGuarded @ zone.dart:1593
[_sendData] @ stream_impl.dart:339
[_add] @ stream_impl.dart:271
[_sendData] @ broadcast_stream_controller.dart:377
add @ broadcast_stream_controller.dart:244
[_publish] @ logger.dart:309
log @ logger.dart:233
warning @ logger.dart:284
handleEventFromRemote @ middleware.dart:152
_checkAndCall @ operations.dart:367
dcall @ operations.dart:372
ret @ js_patch.dart:414
(anonymous) @ page.bundle.js:6
(anonymous) @ page.bundle.js:6
(anonymous) @ page.bundle.js:6
Ce @ page.bundle.js:6
postMessage
L @ content.bundle.js:3

This is in this repo on the branch 419-migrate-to-dart-null-safety-mode, relevant setup code is here:

https://github.com/UC-Davis-molecular-computing/scadnano/blob/69d1e09bfff129e01617e3624312599fbfef9453/lib/src/app.dart#L127-L134

Here's that code

print('SCADNANO_PROD = "${SCADNANO_PROD}", so Redux Devtools enabled; disable it to boost performance');
var middleware_plus = all_middleware + [overReactReduxDevToolsMiddleware];
store = DevToolsStore<AppState>(app_state_reducer, initialState: state, middleware: middleware_plus);

I can verify that the print message occurs, so it is setting up DevToolsStore (not the normal production Store in the else clause a few lines later).

I imagine I'm just doing something wrong, but I haven't changed this setup code in years and it always worked before. It's also not because I recently upgraded to OverReact 5.3.0; before I starting migrating to null safety a few days ago, I used OverReact 4.0.0 and saw the same error.

I'm just hoping someone has seen this error before and has an idea what might be causing it.


FYI: @greglittlefield-wf @aaronlademann-wf @kealjones-wk @evanweible-wf @maxwellpeterson-wf

greglittlefield-wf commented 2 days ago

I wonder if it could be the same Redux DevTools issue as this extension issue: https://github.com/reduxjs/redux-devtools/issues/1731. They mention using an older version of the extension to work around the issue; would you mind trying that out?

Either that, or it could be related to us using a relatively old version of Redux (4.0.5 from react-dart), or other bugs in OverReactReduxDevToolsMiddleware.