fix(WEB): Turbopack use server 파일 간 export type 런타임 에러 수정
- 검사 템플릿 타입(InspectionTemplateData 등)을 WorkerScreen/types.ts로 분리 - use server 파일에서 export type 제거 (Turbopack 모듈 평가 시 값으로 처리되는 문제) - 모든 타입 import를 types.ts 직접 참조로 변경
This commit is contained in:
@@ -22,7 +22,7 @@ import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
import { cn } from '@/lib/utils';
|
||||
import type { InspectionTemplateData } from './actions';
|
||||
import type { InspectionTemplateData } from './types';
|
||||
|
||||
// 중간검사 공정 타입
|
||||
export type InspectionProcessType =
|
||||
@@ -281,7 +281,7 @@ function DynamicInspectionForm({
|
||||
// 양호/불량 토글
|
||||
return (
|
||||
<div key={item.id} className="space-y-1.5">
|
||||
<span className="text-sm font-bold">{item.name}</span>
|
||||
<span className="text-sm font-bold">{item.item || item.name}</span>
|
||||
<div className="flex gap-2 flex-1">
|
||||
<button
|
||||
type="button"
|
||||
@@ -318,17 +318,24 @@ function DynamicInspectionForm({
|
||||
// 판정 표시
|
||||
let itemJudgment: 'pass' | 'fail' | null = null;
|
||||
if (item.tolerance && numValue != null && item.standard_criteria) {
|
||||
const design = parseFloat(item.standard_criteria);
|
||||
const designStr = typeof item.standard_criteria === 'object'
|
||||
? String((item.standard_criteria as Record<string, number>).nominal ?? '')
|
||||
: String(item.standard_criteria);
|
||||
const design = parseFloat(designStr);
|
||||
if (!isNaN(design)) {
|
||||
itemJudgment = evaluateTolerance(numValue, design, item.tolerance);
|
||||
}
|
||||
}
|
||||
|
||||
const placeholderStr = typeof item.standard_criteria === 'object'
|
||||
? String((item.standard_criteria as Record<string, number>).nominal ?? '입력')
|
||||
: (item.standard_criteria || '입력');
|
||||
|
||||
return (
|
||||
<div key={item.id} className="space-y-1.5">
|
||||
<div className="flex items-center gap-2">
|
||||
<span className="text-sm font-bold">
|
||||
{item.name}{toleranceLabel}
|
||||
{item.item || item.name}{toleranceLabel}
|
||||
</span>
|
||||
{itemJudgment && (
|
||||
<span className={cn(
|
||||
@@ -341,7 +348,7 @@ function DynamicInspectionForm({
|
||||
</div>
|
||||
<Input
|
||||
type="number"
|
||||
placeholder={item.standard_criteria || '입력'}
|
||||
placeholder={placeholderStr}
|
||||
value={numValue ?? ''}
|
||||
onChange={(e) => {
|
||||
const v = e.target.value === '' ? null : parseFloat(e.target.value);
|
||||
@@ -378,7 +385,10 @@ function computeDynamicJudgment(
|
||||
const numValue = value as number | null | undefined;
|
||||
if (numValue != null) {
|
||||
hasAnyValue = true;
|
||||
const design = parseFloat(item.standard_criteria);
|
||||
const designStr = typeof item.standard_criteria === 'object'
|
||||
? String((item.standard_criteria as Record<string, number>).nominal ?? '')
|
||||
: String(item.standard_criteria);
|
||||
const design = parseFloat(designStr);
|
||||
if (!isNaN(design)) {
|
||||
const result = evaluateTolerance(numValue, design, item.tolerance);
|
||||
if (result === 'fail') hasFail = true;
|
||||
|
||||
Reference in New Issue
Block a user