Skip to content
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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

KetanReddy
Copy link
Member

@KetanReddy KetanReddy commented Feb 4, 2025

If a new FlowManager instance is passed in while a MangedPlayer 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?

  • Updated docs
  • No Update needed
  • Unable to update docs

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

@KetanReddy KetanReddy added bug Something isn't working patch Increment the patch version when merged labels Feb 4, 2025
@KetanReddy KetanReddy self-assigned this Feb 4, 2025
Copy link

codecov bot commented Feb 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.77%. Comparing base (070c014) to head (35636dc).
Report is 5 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

@KetanReddy
Copy link
Member Author

/canary

Comment on lines 289 to 293
React.useEffect(() => {
if (managedState.state) {
managedState.state.context.manager = props.manager;
}
}, [props.manager]);
Copy link
Member

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?

Copy link
Member Author

@KetanReddy KetanReddy Feb 4, 2025

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);
Copy link
Member

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?

Copy link
Member Author

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.

@KetanReddy
Copy link
Member Author

/canary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working patch Increment the patch version when merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants