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

refactor(app): currentOffsetModal only displays latest offsets #11913

Merged
merged 9 commits into from
Jan 10, 2023
Prev Previous commit
Next Next commit
filter out identity offsets after deduping
  • Loading branch information
b-cooper committed Jan 9, 2023
commit 3cf9ca52510a172dafe333194bdfa2d683aea328
12 changes: 6 additions & 6 deletions app/src/organisms/Devices/ProtocolRun/SetupLabware/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,7 @@ export function getLabwareSetupItemGroups(
export function getLatestCurrentOffsets(
currentOffsets: LabwareOffset[]
): LabwareOffset[] {
const nonIdentityOffsets = currentOffsets.filter(
currentOffset => !isEqual(currentOffset.vector, IDENTITY_VECTOR)
)

const latestCurrentOffsets = nonIdentityOffsets.reduce<LabwareOffset[]>(
const latestCurrentOffsets = currentOffsets.reduce<LabwareOffset[]>(
(acc, offset) => {
const previousMatchIndex = acc.findIndex(
currentLabwareOffsets =>
Expand All @@ -118,5 +114,9 @@ export function getLatestCurrentOffsets(
[]
)

return latestCurrentOffsets
const nonIdentityOffsets = latestCurrentOffsets.filter(
currentOffset => !isEqual(currentOffset.vector, IDENTITY_VECTOR)
)

return nonIdentityOffsets
}