Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .jules/palette.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,6 @@
## 2024-07-13 - ์ผ๊ด„ ์—…๋กœ๋“œ ํผ์— ํ”„๋ฆฌ์…‹ ๋ฒ„ํŠผ ๋ฐ ํŒŒ์ผ ํฌ๊ธฐ ๋ฏธ๋ฆฌ๋ณด๊ธฐ ์ถ”๊ฐ€
**Learning:** ์ผ๊ด„ ํŒŒ์ผ ์—…๋กœ๋“œ ํผ์—์„œ ๋Œ€์ƒ ๋ฐ”์ดํŠธ(target_bytes) ์ž…๋ ฅ ํ•„๋“œ๋งŒ ์ œ๊ณตํ•˜๋ฉด ์‚ฌ์šฉ์ž๊ฐ€ ์›ํ•˜๋Š” ์šฉ๋Ÿ‰์„ ๋ฐ”์ดํŠธ ๋‹จ์œ„๋กœ ์ •ํ™•ํžˆ ๊ณ„์‚ฐํ•˜๊ธฐ ์–ด๋ ค์›Œ ์‚ฌ์šฉ์„ฑ์ด ๋–จ์–ด์ง‘๋‹ˆ๋‹ค. ์‚ฌ์šฉ์ž๊ฐ€ ์—ฌ๋Ÿฌ ํŒŒ์ผ์„ ์—…๋กœ๋“œํ•  ๋•Œ ์ด ํŒŒ์ผ ํฌ๊ธฐ๋ฅผ ํŒŒ์•…ํ•˜์ง€ ๋ชปํ•ด ์—…๋กœ๋“œ ์ œํ•œ์„ ์ดˆ๊ณผํ•˜๊ฑฐ๋‚˜ ์ž˜๋ชป๋œ ๋Œ€์ƒ ๋ฐ”์ดํŠธ๋ฅผ ์„ค์ •ํ•  ์œ„ํ—˜์ด ํฝ๋‹ˆ๋‹ค.
**Action:** ์ผ๊ด„ ํŒŒ์ผ ์—…๋กœ๋“œ ํผ์—๋„ ๋‹จ์ผ ํŒŒ์ผ ์—…๋กœ๋“œ ํผ๊ณผ ๋™์ผํ•˜๊ฒŒ ๋Œ€์ƒ ๋ฐ”์ดํŠธ๋ฅผ ์‰ฝ๊ฒŒ ์„ ํƒํ•  ์ˆ˜ ์žˆ๋Š” ๋น ๋ฅธ ํ”„๋ฆฌ์…‹ ๋ฒ„ํŠผ์„ ์ถ”๊ฐ€ํ•˜๊ณ , `onchange` ์ด๋ฒคํŠธ ๋ฐœ์ƒ ์‹œ ์„ ํƒ๋œ ๋ชจ๋“  ํŒŒ์ผ์˜ ํฌ๊ธฐ๋ฅผ ํ•ฉ์‚ฐํ•˜์—ฌ ์‚ฌ๋žŒ์ด ์ฝ๊ธฐ ์‰ฌ์šด ๋‹จ์œ„(MiB, GiB ๋“ฑ)๋กœ ๋ฏธ๋ฆฌ๋ณด๊ธฐ๋ฅผ ์ œ๊ณตํ•˜๋„๋ก JavaScript ๋กœ์ง์„ ๊ฐœ์„ ํ–ˆ์Šต๋‹ˆ๋‹ค.
## 2024-07-15 - Handle Empty Input State in Numeric Validation
**Learning:** When using JavaScript to validate numeric inputs (e.g., parsing with `parseInt`), an empty input field is parsed as `NaN`. If `isNaN` checks are not explicitly guarded against an empty string, clearing the input field will prematurely trigger a validation error (e.g., "Must be greater than 0"), rather than letting HTML5's native `required` attribute handle the empty state smoothly.
**Action:** When implementing JavaScript inline validation for numeric inputs, explicitly handle the empty string state (e.g., `if (this.value === '')`) to clear custom errors and `innerText` before applying `isNaN` checks.
8 changes: 6 additions & 2 deletions saas_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,9 @@ async def add_security_headers(request: Request, call_next):
);
});

if (isNaN(val) || val <= 0) {
if (this.value === '') {
preview.innerText = '';
} else if (isNaN(val) || val <= 0) {
preview.innerText = 'Must be greater than 0.';
preview.style.color = '#dc3545';
this.setCustomValidity('Must be greater than 0.');
Expand All @@ -282,7 +284,9 @@ async def add_security_headers(request: Request, call_next):
);
});

if (isNaN(val) || val <= 0) {
if (this.value === '') {
preview.innerText = '';
} else if (isNaN(val) || val <= 0) {
preview.innerText = 'Must be greater than 0.';
preview.style.color = '#dc3545';
this.setCustomValidity('Must be greater than 0.');
Expand Down
Loading