Skip to content

Commit

Permalink
Always show error regardless of animation timeline (#7314)
Browse files Browse the repository at this point in the history
* Don't remove info data on focus

* Find first error frame and show it regardless of anything else
  • Loading branch information
dem4ron authored Jan 14, 2025
1 parent 8a8e3f6 commit 58f075a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,13 @@ export const CodeMirror = forwardRef(function _CodeMirror(
Ext.multiHighlightLine({ from: 0, to: 0 }),
readonlyCompartment.of([EditorView.editable.of(!readonly)]),
onEditorFocus(
() => setShouldShowInformationWidget(false),
() =>
setInformationWidgetData({
html: '',
line: 0,
status: 'SUCCESS',
})
() => setShouldShowInformationWidget(false)
// () =>
// setInformationWidgetData({
// html: '',
// line: 0,
// status: 'SUCCESS',
// })
),
onEditorChange(
() => setHighlightedLine(0),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,16 @@ export function useScrubber({

// this effect is responsible for updating the highlighted line and information widget based on currentFrame
useEffect(() => {
let currentFrame: Frame | undefined
if (testResult.animationTimeline) {
currentFrame = testResult.animationTimeline.currentFrame
} else {
currentFrame = testResult.frames[value]
let currentFrame: Frame | undefined = testResult.frames.find(
(f) => f.status === 'ERROR'
)

if (!currentFrame) {
if (testResult.animationTimeline) {
currentFrame = testResult.animationTimeline.currentFrame
} else {
currentFrame = testResult.frames[value]
}
}
if (currentFrame) {
setHighlightedLine(currentFrame.line)
Expand Down Expand Up @@ -76,6 +81,7 @@ export function useScrubber({
testResult.view?.id,
value,
testResult.animationTimeline?.currentFrameIndex,
testResult.frames,
])

const handleScrubToCurrentTime = useCallback(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function generateExpectsForStateTests(
: argsString.split(',').map((arg) => safe_eval(arg.trim()))

// And then we get the function and call it.
console.log(fnName)
// console.log(fnName)
const fn = exercise[fnName]
actual = fn.bind(exercise).call(exercise, interpreterResult, ...args)
}
Expand Down

0 comments on commit 58f075a

Please sign in to comment.