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

Adapt kolibri to use latest version of xstate library #12783

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

jredrejo
Copy link
Member

@jredrejo jredrejo commented Nov 4, 2024

Summary

Changes in machines and components to upgrade xstate library in kolibri from version 4 to version 5.

This PR will have to stay in draft until learningequality/kolibri-design-system#814 can be merged, so kolibri design system uses xstate version 5 too.

Until KDS uses this library tests of the implementation won't work as it will drag xstate v4.

References

Closes: #11614

Reviewer guidance

  • Gherking scenarios related to setup wizard and merge facilities must be checked
  • Tests pass

Testing checklist

  • Contributor has fully tested the PR manually
  • If there are any front-end changes, before/after screenshots are included
  • Critical user journeys are covered by Gherkin stories
  • Critical and brittle code paths are covered by unit tests

PR process

  • PR has the correct target branch and milestone
  • PR has 'needs review' or 'work-in-progress' label
  • If PR is ready for review, a reviewer has been added. (Don't use 'Assignees')
  • If this is an important user-facing change, PR or related issue has a 'changelog' label
  • If this includes an internal dependency change, a link to the diff is provided

Reviewer checklist

  • PR is fully functional
  • PR has been tested for accessibility regressions
  • External dependency files were updated if necessary (yarn and pip)
  • Documentation is updated
  • Contributor is in AUTHORS.md

@jredrejo jredrejo requested a review from MisRob November 4, 2024 16:09
@github-actions github-actions bot added APP: User Re: User app (sign-in, sign-up, user profile, etc.) APP: Setup Wizard Re: Setup Wizard (facility import, superuser creation, settings, etc.) DEV: frontend labels Nov 4, 2024
Copy link
Member

@nucleogenesis nucleogenesis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I read through the code and it largely looks great - I love seeing v5 in action here and that the API changes were relatively straightforward.

The one issue I noted regarding the wizardMachine guards might be blocking - I didn't spin it up yet and may be missing something there. Otherwise, just a suggestion to update a comment.

@@ -103,11 +102,11 @@ export const wizardMachine = createMachine(
{
// `cond` takes a function that returns a Boolean, continuing to the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Picking a nit - the comment here still references cond.

return context.fullOrLOD === DeviceTypePresets.FULL;
},
isNewFacility: context => context.facilityNewOrImport === FacilityTypePresets.NEW,
isImportFacility: context => context.facilityNewOrImport === FacilityTypePresets.IMPORT,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I notice that the function passed to guard seems to be expecting an object on the first param (relevant docs) shaped like { context, event } -- but here we only handle one param as if it's the context.

Makes me wonder if there might be issues uncovered by tests in the setup wizard because of this.

@akolson akolson self-requested a review November 11, 2024 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
APP: Setup Wizard Re: Setup Wizard (facility import, superuser creation, settings, etc.) APP: User Re: User app (sign-in, sign-up, user profile, etc.) DEV: frontend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade xstate to version 5.x
2 participants