This fixes the simple cases of callback props using lambda functions.
This will prevent rerendering in some cases since a new callback
function is not created on each call.
This uses the real rootReducer to populate the initial state in the test
AsyncSaga. This way we don't have to populate default values. Since it
isn't used often, we can omit the parameter and just call the updateState()
method after creating the object if modifications are needed.
- registration is moved from top-level index to app/sagas.
- mock implementation is provided for tests
- actions are renamed to include "app" prefix
- actions are changed to not use non-serializable arguments
- reducers are changed to not use non-serializable state
This removed passing the BeforeInstallPromptEvent as an action argument
(action arguments should be serializable). Instead the saga just keeps
a reference to the event and actions are used only to resolve the state
of the UI.
The editor saga was assuming that main.py always exists, which is not
the case for the first use of the app. This fixes the issue by checking
to see if the file exists before attempting to open it. This also
revealed a bug in fileStorage where the list of files was not populated
during initialization.
This removes use of the pseudo-internal toString() function and also
removes extraneous uses of ReturnType<>. Also, a new when() method
is added to simplify additional uses.
The pattern we were using for actions required actions to be defined in
three places, an enum member containing the type string, an type
definition and a function. This combines all three of these into one by
using a helper function based on the ideas from [1].
[1]: https://phryneas.de/redux-typescript-no-discriminating-union
This replaces the localStorage file storage with a new backend that uses
localForage (indexeddb) for storing the file contents. This will also
allow storing multiple files.
The try/catch would also suppress the fail() which would make the test
always succeed even when it should fail.
Jest has a .rejects API that can be used instead.
This adds a basic battery indicator that just shows green for OK and red
for low battery warning. This is all we can do for now since that is
the only information that the hub sends currently.
Fixes: https://github.com/pybricks/support/issues/559
This adds an indicator to the status bar that shows the hub name. When
clicked, a popover will be displayed that lists more detailed information
about the connected hub.