-
Notifications
You must be signed in to change notification settings - Fork 0
알림 테스트 #11
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
알림 테스트 #11
Conversation
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.
Pull Request Overview
This PR implements code persistence functionality by restoring the last executed code from localStorage when the playground page is loaded. It also adds hydration error handling for the Zustand store.
- Added
getInitialCode()function to retrieve previously executed code from localStorage - Implemented
onRehydrateStoragecallback to handle hydration errors and reset execution state on app restart - Updated initial state of code editor to use persisted code instead of default "Hello, ExecuteJS!" message
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| apps/executeJS/src/pages/playground/playground-page.tsx | Added getInitialCode() function to restore code from localStorage and updated useState initialization to use it |
| apps/executeJS/src/features/execute-code/model.ts | Added onRehydrateStorage callback to handle hydration errors and reset execution state on app restart |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const getInitialCode = (): string => { | ||
| try { | ||
| const executionStorage = localStorage.getItem( | ||
| 'executejs-execution-storage' |
Copilot
AI
Oct 30, 2025
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.
The storage key 'executejs-execution-storage' is duplicated between this file and model.ts. Consider extracting it to a shared constant to maintain consistency and avoid potential mismatches.
| const getInitialCode = (): string => { | |
| try { | |
| const executionStorage = localStorage.getItem( | |
| 'executejs-execution-storage' | |
| const EXECUTION_STORAGE_KEY = 'executejs-execution-storage'; | |
| const getInitialCode = (): string => { | |
| try { | |
| const executionStorage = localStorage.getItem( | |
| EXECUTION_STORAGE_KEY |
| if (error) { | ||
| console.error('hydration failed:', error); | ||
| // persist 실패 시 localStorage 정리 | ||
| localStorage.removeItem('executejs-execution-storage'); |
Copilot
AI
Oct 30, 2025
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.
The storage key 'executejs-execution-storage' is hardcoded here but already defined at line 65. Reference the existing 'name' property from the persist configuration or extract to a constant to avoid duplication.
| const code = parsed?.state?.result?.code; | ||
|
|
||
| if (code) { | ||
| console.log('result from executionStorage:', code); |
Copilot
AI
Oct 30, 2025
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.
Console.log statements should be removed from production code or replaced with a proper logging mechanism. Consider removing this debug log or using a conditional logger.
| console.log('result from executionStorage:', code); |
| } | ||
|
|
||
| if (state) { | ||
| console.log('hydration success'); |
Copilot
AI
Oct 30, 2025
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.
Console.log statements should be removed from production code or replaced with a proper logging mechanism. Consider removing this debug log or using a conditional logger.
| console.log('hydration success'); |
ㅁㄴㅇㄹ