-
Notifications
You must be signed in to change notification settings - Fork 179
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
feat(app, react-api-client): wire up deck configuration editor and add useCreateDeckConfigurationMutation #13817
feat(app, react-api-client): wire up deck configuration editor and add useCreateDeckConfigurationMutation #13817
Conversation
update deck configuration editor, add fixture modal, and deck config discard modal to align with expected behavior. RAUT-804
|
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## edge #13817 +/- ##
==========================================
+ Coverage 70.61% 70.63% +0.02%
==========================================
Files 2448 2457 +9
Lines 67325 68855 +1530
Branches 8478 9111 +633
==========================================
+ Hits 47542 48637 +1095
- Misses 17781 18073 +292
- Partials 2002 2145 +143
Flags with carried forward coverage won't be shown. Click here to find out more.
|
app/src/organisms/DeviceDetailsDeckConfiguration/AddFixtureModal.tsx
Outdated
Show resolved
Hide resolved
…refactor-wireup-deckconfiguration-confirmbutton
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.
some initial comments on handling deck config local state
const [deckConfigData, setDeckConfigData] = React.useState<DeckConfigData>({ | ||
addedFixture: null, | ||
currentDeckConfig: deckConfig, | ||
}) |
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.
this local state should just be a DeckConfiguration
- we don't need to pass an added fixture into state.
then, probably the way we should handle setting state (in add fixture modal) is to use an updater function to set state based on previous state. something like (psuedo):
previousState => {
// filter previous state by fixtureLocation
// append new fixture
// return new state
}
another option is useReducer but we probably don't need to go there for this
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.
and handleClickRemove
needs to be updated to use the local state config in a similar way, appending a standard slot to the local state
@@ -118,7 +145,7 @@ export function DeckConfiguration(): JSX.Element { | |||
justifyContent={JUSTIFY_CENTER} | |||
> | |||
<DeckConfigurator | |||
deckConfig={deckConfig} | |||
deckConfig={deckConfigData.currentDeckConfig} |
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.
this data initializes to []
because the query is async - we need to:
- add a
useEffect
to update local state when the deck config query resolves - probably block rendering the configurator (render null) when deck config length == 0 because current it renders as an empty deck map on load
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.
import type { ModalHeaderBaseProps } from '../../molecules/Modal/types' | ||
import type { LegacyModalProps } from '../../molecules/LegacyModal' | ||
|
||
interface AddFixtureModalProps { | ||
fixtureLocation: Cutout | ||
setShowAddFixtureModal: (showAddFixtureModal: boolean) => void | ||
setCurrentDeckConfig?: React.Dispatch<React.SetStateAction<DeckConfiguration>> |
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.
we need this change because the following gets typescript type error
setCurrentDeckConfig: (currentDeckConfig: DeckConfiguration) => void
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.
just some routing comments, good to merge after those addressed ✔️
…d useCreateDeckConfigurationMutation (#13817) *feat(app, react-api-client): wire up deck configuration editor and add useCreateDeckConfigurationMutation
Overview
update deck configuration editor, add fixture modal, and deck config discard modal to align with expected behavior.
close RAUT-804
Test Plan
Changelog
Review requests
DeckConfigurationEditor
to avoid a name conflict but I didn't change the folder name since Rob is working on re-organizing Figma and at some point we will need to align components' names with design.[related thread]
https://opentrons.slack.com/archives/CSCLVUW3C/p1698246368962059?thread_ts=1698246124.637669&cid=CSCLVUW3C
Risk assessment
low