-
Notifications
You must be signed in to change notification settings - Fork 14
chore: force select only the matching guide when forced guide key is set #843
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| nodejs 24.12.0 | ||
| nodejs 24.13.0 | ||
| yarn 1.22.22 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,6 +52,6 @@ | |
| "vitest": "^3.1.1" | ||
| }, | ||
| "engines": { | ||
| "node": ">=24.10.0" | ||
| "node": ">=24.13.0" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -157,29 +157,11 @@ const select = (state: StoreState, filters: SelectFilterParams = {}) => { | |
| const defaultGroup = findDefaultGroup(state.guideGroups); | ||
| if (!defaultGroup) return result; | ||
|
|
||
| const displaySequence = [...defaultGroup.display_sequence]; | ||
| const displaySequence = defaultGroup.display_sequence; | ||
| const location = state.location; | ||
|
|
||
| // If in debug mode, put the forced guide at the beginning of the display sequence. | ||
| if (state.debug.forcedGuideKey) { | ||
| const forcedKeyIndex = displaySequence.indexOf(state.debug.forcedGuideKey); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Preview guides not in display sequence cannot be shownLow Severity The removal of the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is true, and I think we should move toward the behavior where only published guides can be rendered. |
||
| if (forcedKeyIndex > -1) { | ||
| displaySequence.splice(forcedKeyIndex, 1); | ||
| } | ||
| displaySequence.unshift(state.debug.forcedGuideKey); | ||
| } | ||
|
|
||
| for (const [index, guideKey] of displaySequence.entries()) { | ||
| let guide = state.guides[guideKey]; | ||
|
|
||
| // Use preview guide if it exists and matches the forced guide key | ||
| if ( | ||
| state.debug.forcedGuideKey === guideKey && | ||
| state.previewGuides[guideKey] | ||
| ) { | ||
| guide = state.previewGuides[guideKey]; | ||
| } | ||
|
|
||
| const guide = state.previewGuides[guideKey] || state.guides[guideKey]; | ||
| if (!guide) continue; | ||
|
|
||
| const affirmed = predicate(guide, { | ||
|
|
@@ -215,11 +197,11 @@ const predicate = ( | |
| return false; | ||
| } | ||
|
|
||
| // Bypass filtering if the debugged guide matches the given filters. | ||
| // This should always run AFTER checking the filters but BEFORE | ||
| // checking archived status and location rules. | ||
| if (debug.forcedGuideKey === guide.key) { | ||
| return true; | ||
| // If in debug mode with a forced guide key, bypass other filtering and always | ||
| // return true for that guide only. This should always run AFTER checking the | ||
| // filters but BEFORE checking archived status and location rules. | ||
| if (debug.forcedGuideKey) { | ||
| return debug.forcedGuideKey === guide.key; | ||
| } | ||
|
|
||
| if (!guide.active) { | ||
|
|
@@ -736,17 +718,8 @@ export class KnockGuideClient { | |
| // callback to a setTimeout, but just to be safe. | ||
| this.ensureClearTimeout(); | ||
|
|
||
| // If in debug mode, try to resolve the forced guide, otherwise return the first non-undefined guide. | ||
| let resolved = undefined; | ||
| if (this.store.state.debug.forcedGuideKey) { | ||
| resolved = this.stage.ordered.find( | ||
| (x) => x === this.store.state.debug.forcedGuideKey, | ||
| ); | ||
| } | ||
|
|
||
| if (!resolved) { | ||
| resolved = this.stage.ordered.find((x) => x !== undefined); | ||
| } | ||
| // Resolve to the first non-undefined guide in the stage. | ||
| const resolved = this.stage.ordered.find((x) => x !== undefined); | ||
|
|
||
| this.knock.log( | ||
| `[Guide] Closing the current group stage: resolved=${resolved}`, | ||
|
|
||


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.
Unrelated, upgrading to the same node version we are using in control.