next.js/test/e2e/react-compiler/app/function-naming/page.tsx
page.tsx24 lines620 B
'use client'

import { useEffect, useState } from 'react'

export default function Page() {
  const [callFrame, setCallFrame] = useState<string | null>(null)
  useEffect(() => {
    const error = new Error('test-top-frame')
    console.error(error)

    const callStack = new Error('test-top-frame').stack!.split(
      'test-top-frame\n'
    )[1]
    // indices might change due to different compiler optimizations
    const callFrame = callStack.split('\n')[0]
    setCallFrame(callFrame)
  }, [])
  return (
    <pre data-testid="call-frame" aria-busy={callFrame === null}>
      {String(callFrame)}
    </pre>
  )
}
Quest for Codev2.0.0
/
SIGN IN