Make ignore buttons be session only in checklist (#1675)

This commit is contained in:
lucas lelievre
2026-01-05 16:21:36 +01:00
committed by GitHub
parent 686499f8dd
commit f09cd687c7
5 changed files with 79 additions and 28 deletions

View File

@@ -54,11 +54,11 @@ export function TrackingChecklistSettings({
// doing it this way prevents calling ignore step for every step.
// that prevent sending a packet for steps that didnt change
if (!value && !ignoredSteps.includes(stepId)) {
ignoreStep(stepId, true);
ignoreStep(stepId, true, false);
}
if (value && ignoredSteps.includes(stepId)) {
ignoreStep(stepId, false);
ignoreStep(stepId, false, false);
}
}
};

View File

@@ -109,7 +109,10 @@ const stepContentLookup: Record<
context: TrackingChecklistContext
) => JSX.Element
> = {
[TrackingChecklistStepId.TRACKERS_REST_CALIBRATION]: (step, { toggle }) => {
[TrackingChecklistStepId.TRACKERS_REST_CALIBRATION]: (
step,
{ toggleSession }
) => {
return (
<div className="space-y-2.5">
<Typography id="tracking_checklist-TRACKERS_REST_CALIBRATION-desc" />
@@ -118,7 +121,7 @@ const stepContentLookup: Record<
<Button
id="tracking_checklist-ignore"
variant="secondary"
onClick={() => toggle(step.id)}
onClick={() => toggleSession(step.id)}
/>
)}
</div>
@@ -166,7 +169,7 @@ const stepContentLookup: Record<
</div>
);
},
[TrackingChecklistStepId.STEAMVR_DISCONNECTED]: (step, { toggle }) => {
[TrackingChecklistStepId.STEAMVR_DISCONNECTED]: (step, { toggleSession }) => {
return (
<>
<div className="space-y-2.5">
@@ -181,7 +184,7 @@ const stepContentLookup: Record<
<Button
id="tracking_checklist-ignore"
variant="secondary"
onClick={() => toggle(step.id)}
onClick={() => toggleSession(step.id)}
/>
)}
</div>
@@ -195,7 +198,10 @@ const stepContentLookup: Record<
[TrackingChecklistStepId.UNASSIGNED_HMD]: () => {
return <Typography id="tracking_checklist-UNASSIGNED_HMD-desc" />;
},
[TrackingChecklistStepId.NETWORK_PROFILE_PUBLIC]: (step, { toggle }) => {
[TrackingChecklistStepId.NETWORK_PROFILE_PUBLIC]: (
step,
{ toggleSession }
) => {
const data = step.extraData as TrackingChecklistPublicNetworksT | null;
return (
<>
@@ -226,7 +232,7 @@ const stepContentLookup: Record<
<Button
id="tracking_checklist-ignore"
variant="secondary"
onClick={() => toggle(step.id)}
onClick={() => toggleSession(step.id)}
/>
)}
</div>
@@ -234,7 +240,7 @@ const stepContentLookup: Record<
</>
);
},
[TrackingChecklistStepId.VRCHAT_SETTINGS]: (step, { toggle }) => {
[TrackingChecklistStepId.VRCHAT_SETTINGS]: (step, { toggleSession }) => {
return (
<>
<div className="space-y-2.5">
@@ -249,7 +255,7 @@ const stepContentLookup: Record<
<Button
id="tracking_checklist-ignore"
variant="secondary"
onClick={() => toggle(step.id)}
onClick={() => toggleSession(step.id)}
/>
)}
</div>
@@ -257,7 +263,7 @@ const stepContentLookup: Record<
</>
);
},
[TrackingChecklistStepId.MOUNTING_CALIBRATION]: (step, { toggle }) => {
[TrackingChecklistStepId.MOUNTING_CALIBRATION]: (step, { toggleSession }) => {
return (
<div className="space-y-2.5">
<Typography id="onboarding-automatic_mounting-mounting_reset-step-0" />
@@ -275,14 +281,17 @@ const stepContentLookup: Record<
<Button
id="tracking_checklist-ignore"
variant="secondary"
onClick={() => toggle(step.id)}
onClick={() => toggleSession(step.id)}
/>
)}
</div>
</div>
);
},
[TrackingChecklistStepId.FEET_MOUNTING_CALIBRATION]: (step, { toggle }) => {
[TrackingChecklistStepId.FEET_MOUNTING_CALIBRATION]: (
step,
{ toggleSession }
) => {
return (
<div className="space-y-2.5">
<Typography id="onboarding-automatic_mounting-mounting_reset-feet-step-0" />
@@ -309,14 +318,17 @@ const stepContentLookup: Record<
<Button
id="tracking_checklist-ignore"
variant="secondary"
onClick={() => toggle(step.id)}
onClick={() => toggleSession(step.id)}
/>
)}
</div>
</div>
);
},
[TrackingChecklistStepId.STAY_ALIGNED_CONFIGURED]: (step, { toggle }) => {
[TrackingChecklistStepId.STAY_ALIGNED_CONFIGURED]: (
step,
{ toggleSession }
) => {
return (
<>
<div className="space-y-2.5">
@@ -332,7 +344,7 @@ const stepContentLookup: Record<
<Button
id="tracking_checklist-ignore"
variant="secondary"
onClick={() => toggle(step.id)}
onClick={() => toggleSession(step.id)}
/>
)}
</div>

View File

@@ -92,8 +92,16 @@ export type Steps = {
visibleSteps: TrackingChecklistStep[];
ignoredSteps: TrackingChecklistStepId[];
};
const filterActive =
(ignoredSteps: TrackingChecklistStepId[]) => (step: TrackingChecklistStepT) =>
!ignoredSteps.includes(step.id) && step.enabled;
export function provideTrackingChecklist() {
const { sendRPCPacket, useRPCPacket } = useWebsocketAPI();
const [sessionIgnoredSteps, setSessionIgnoredSteps] = useState<
TrackingChecklistStepId[]
>([]);
const [steps, setSteps] = useState<Steps>({
steps: [],
visibleSteps: [],
@@ -104,7 +112,7 @@ export function provideTrackingChecklist() {
RpcMessage.TrackingChecklistResponse,
(data: TrackingChecklistResponseT) => {
const activeSteps = data.steps.filter(
(step) => !data.ignoredSteps.includes(step.id) && step.enabled
filterActive([...data.ignoredSteps, ...sessionIgnoredSteps])
);
setSteps({
steps: data.steps,
@@ -161,26 +169,48 @@ export function provideTrackingChecklist() {
[steps]
);
const ignoreStep = (step: TrackingChecklistStepId, ignore: boolean) => {
const res = new IgnoreTrackingChecklistStepRequestT();
res.stepId = step;
res.ignore = ignore;
sendRPCPacket(RpcMessage.IgnoreTrackingChecklistStepRequest, res);
Sentry.metrics.count(ignore ? 'mute_checklist_step' : 'unmute_checklist_step', 1, {
attributes: { step: TrackingChecklistStepId[step] },
const ignoreStep = (
step: TrackingChecklistStepId,
ignore: boolean,
session = true
) => {
setSessionIgnoredSteps((curr) => {
if (ignore && !curr.includes(step)) return [...curr, step];
if (!ignore && curr.includes(step)) {
curr.splice(curr.indexOf(step), 1);
return curr;
}
return curr;
});
Sentry.metrics.count(ignore ? 'mute_checklist_step' : 'unmute_checklist_step', 1, {
attributes: { step: TrackingChecklistStepId[step], session },
});
if (session) {
// Force refresh of the flightlist when ignoring a step as the filtering
// is done only in one place to simplify the data flow
sendRPCPacket(
RpcMessage.TrackingChecklistRequest,
new TrackingChecklistRequestT()
);
} else {
const res = new IgnoreTrackingChecklistStepRequestT();
res.stepId = step;
res.ignore = ignore;
sendRPCPacket(RpcMessage.IgnoreTrackingChecklistStepRequest, res);
}
};
return {
...steps,
sessionIgnoredSteps,
firstRequired,
highlightedTrackers,
progress,
completion,
warnings,
ignoreStep,
toggle: (step: TrackingChecklistStepId) =>
ignoreStep(step, !steps.ignoredSteps.includes(step)),
toggleSession: (step: TrackingChecklistStepId) =>
ignoreStep(step, !sessionIgnoredSteps.includes(step)),
};
}

View File

@@ -339,6 +339,15 @@ public class CurrentVRConfigConverter implements VersionedModelConverter {
}
}
}
if (version < 15) {
ObjectNode checklistNode = (ObjectNode) modelData.get("trackingChecklist");
if (checklistNode != null) {
ArrayNode ignoredStepsArray = (ArrayNode) checklistNode.get("ignoredStepsIds");
if (ignoredStepsArray != null)
ignoredStepsArray.removeAll();
}
}
} catch (Exception e) {
LogManager.severe("Error during config migration: " + e);
}

View File

@@ -10,8 +10,8 @@ import dev.slimevr.tracking.trackers.Tracker
import dev.slimevr.tracking.trackers.TrackerRole
@JsonVersionedModel(
currentVersion = "14",
defaultDeserializeToVersion = "14",
currentVersion = "15",
defaultDeserializeToVersion = "15",
toCurrentConverterClass = CurrentVRConfigConverter::class,
)
class VRConfig {