[ Feat ] 로그인 상태 유지할 수 있도록 일렉트론 메인프로세스 로직 수정 #327
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
[ Feat ] 로그인 상태 유지할 수 있도록 코드 수정
🔥 Related Issues
+++ 07.26.21.05 내일까지 자세하게 이슈 정리해서 pr 내용 추가하겠습니다. 조금만 기다려주십셔 🙇♂️🙇♂️🙇♂️✅ 작업 리스트
<Navigate>→useNavigate)🔧 작업 내용
1. 브라우저/ 파일 시스템에서의 public path(vite.config.ts의 base) 분기
📁 변경 파일:
package.json,vite.config.ts--mode react플래그 추가로 브라우저, 일렉트론 환경에서 vite.config.ts의 base를 다르게 적용해줌으로써 public path(루트 경로 Prefix)를 다르게 설정해주었습니다./(절대 경로)https://app.morib.in) -> 최상위 도메인은 보통 dist 폴더를 가리키고 있음.적절file://)부적절-file://electron.js./(상대 경로)https://app.morib.in/example)부적절-https://app.morib.in/example적절2. 인증 상태 관리 중앙집중화
📁 새 파일:
src/app/shared/config/auth.ts📁 변경 파일:
src/app/shared/utils/auth.ts3. 로그인 페이지에서 이미 토큰이 존재할 경우 home으로 리디렉션
📁 변경 파일:
src/app/pages/LoginPage/LoginPage.tsx4. 라우팅 로직 개선
📁 변경 파일:
src/app/router/ProtectedRoute.tsx,src/app/router/Router.tsx<Navigate>컴포넌트에서useNavigate훅으로 변경하여 이슈 해결5. Electron 메인 프로세스에서 URL 로딩 시 "A component suspended while responding to synchronous input" 오류 해결
6. 로그아웃 기능 개선
📁 새 파일:
src/app/shared/hooks/useLogout.ts📁 변경 파일:
src/app/shared/apisV2/setting/setting.mutations.ts,AccountContent.tsxlocation.href대신 React Router 네비게이션 활용 (일렉트론의 파일 시스템 경로 고려)7. Electron 메인 프로세스 역할 별로 모듈 분리
📁 변경 파일:
src/electron/main.ts(94줄 추가, 252줄 삭제)📁 새 파일들:
src/electron/contants/protocol.ts- 프로토콜 상수src/electron/monitor/browser.ts- 브라우저 모니터링 로직src/electron/notification/mac.ts- macOS 알림 기능src/electron/window/key.ts- 키보드 제어 로직src/electron/window/os.ts- OS 관련 유틸리티src/electron/window/resolution.ts- 해상도/줌 관리주요 개선사항:
authWindow와mainWindow두 개 창 관리 → 변경:mainWindow하나로 통합🧐 새로 알게된 점
<Navigate>컴포넌트와useNavigate훅의 동작 차이<Navigate>는 렌더링 시점에 즉시 리다이렉트useNavigate는 이벤트 핸들러 내에서 호출 시 더 안정적이다.Electron vs Browser 경로 인식:
코드스플릿팅과 Suspense:
Electron 모듈 분리의 효과:
🤔 궁금한 점
📸 스크린샷 / GIF / Link