-
Notifications
You must be signed in to change notification settings - Fork 50
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
[WIP] Update FlowManager in Managed Player state if a new one is passed in #585
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #585 +/- ##
==========================================
+ Coverage 89.76% 89.77% +0.01%
==========================================
Files 331 331
Lines 19840 19863 +23
Branches 1949 1951 +2
==========================================
+ Hits 17809 17832 +23
Misses 2017 2017
Partials 14 14 ☔ View full report in Codecov by Sentry. |
/canary |
React.useEffect(() => { | ||
if (managedState.state) { | ||
managedState.state.context.manager = props.manager; | ||
} | ||
}, [props.manager]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO this feels like we should be terminating the old managed-player before picking up with the new one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this was just me hacking things together to test if this was the source of the issue. In theory a new Flow Manager should only be passed when managed player is in a completed
state before the pending
state builds the next
function called later in the pending
state. If the parent app wants to override the initial Flow Manager it started player with, it should only be able to do so between flows.
options.middleware, | ||
); | ||
|
||
const [managedState, setManagedState] = React.useState(initialManagedState); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this kept in state, or could it be a ref
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since it should trigger a re-render when we create a new managed state I figured it should be kept in state. I guess technically because things will re-render anyways when the new flow comes in we don't need to do that twice. I can move it over to a ref.
/canary |
If a new
FlowManager
instance is passed in while aMangedPlayer
instance is running, when managed player transitions it will be using the old flow manager instance.Change Type (required)
Indicate the type of change your pull request is:
patch
minor
major
N/A
Does your PR have any documentation updates?
Release Notes
TBD
📦 Published PR as canary version:
0.10.3--canary.585.19781
Try this version out locally by upgrading relevant packages to 0.10.3--canary.585.19781