-
Notifications
You must be signed in to change notification settings - Fork 2
perf: achieve 100/100 react-doctor score #155
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
Changes from all commits
71903da
c085780
43761b7
481a111
0869157
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,31 +1,38 @@ | ||
| --- | ||
| name: Bug Report 🐛 | ||
| about: Create a report to help us improve and fix bugs in Frontend Junction. | ||
| title: "[BUG] " | ||
| title: '[BUG] ' | ||
| labels: bug, triage | ||
| assignees: "" | ||
| assignees: '' | ||
| --- | ||
|
|
||
| ## Description | ||
|
|
||
| <!-- A clear and concise description of what the bug is. --> | ||
|
|
||
| ## Steps to Reproduce | ||
|
|
||
| <!-- Steps to reproduce the behavior: --> | ||
|
|
||
| 1. Go to '...' | ||
| 2. Click on '....' | ||
| 3. Scroll down to '....' | ||
| 4. See error | ||
|
|
||
| ## Expected Behavior | ||
|
|
||
| <!-- A clear and concise description of what you expected to happen. --> | ||
|
|
||
| ## Screenshots / Screen Recordings | ||
|
|
||
| <!-- If applicable, add screenshots or recordings to help explain your problem. --> | ||
|
|
||
| ## Environment Details | ||
|
|
||
| - **Browser**: [e.g. Chrome, Safari, Firefox] | ||
| - **OS**: [e.g. macOS, Windows, iOS, Android] | ||
| - **Device (if mobile)**: [e.g. iPhone 15, Pixel 8] | ||
|
|
||
| ## Additional Context | ||
|
|
||
| <!-- Add any other context about the problem here (e.g., console logs, stack traces). --> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,23 @@ | ||
| --- | ||
| name: Feature Request ✨ | ||
| about: Suggest a new idea or enhancement for Frontend Junction. | ||
| title: "[FEATURE] " | ||
| title: '[FEATURE] ' | ||
| labels: enhancement, triage | ||
| assignees: "" | ||
| assignees: '' | ||
| --- | ||
|
|
||
| ## Is your feature request related to a problem? | ||
|
|
||
| <!-- A clear and concise description of what the problem is. E.g. I'm always frustrated when [...] --> | ||
|
|
||
| ## Proposed Solution | ||
|
|
||
| <!-- A clear and concise description of what you want to happen. --> | ||
|
|
||
| ## Alternative Solutions Considered | ||
|
|
||
| <!-- A clear and concise description of any alternative solutions or features you've considered. --> | ||
|
|
||
| ## Additional Context | ||
|
|
||
| <!-- Add any other context, mockups, or screenshots about the feature request here. --> |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -37,6 +37,10 @@ async function fetchMediumContent(url: string) { | |||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| export async function GET(request: Request) { | ||||||||||||||||||||||
| return POST(request); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| export async function POST(request: Request) { | ||||||||||||||||||||||
|
Comment on lines
39
to
+43
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win Keep this write path POST-only. Line 40 makes a Proposed fix export async function GET(request: Request) {
- return POST(request);
+ return NextResponse.json({ error: 'Method not allowed' }, { status: 405 });
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||
| // Security Check | ||||||||||||||||||||||
| const { searchParams } = new URL(request.url); | ||||||||||||||||||||||
| const key = searchParams.get('key'); | ||||||||||||||||||||||
|
|
@@ -66,7 +70,7 @@ export async function GET(request: Request) { | |||||||||||||||||||||
| ); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| const model = genAI.getGenerativeModel({ model: 'gemini-2.0-flash' }); | ||||||||||||||||||||||
| const model = genAI.getGenerativeModel({ model: 'gemini-2.5-flash' }); | ||||||||||||||||||||||
| const results = { scraped: 0, user: 0, legacy: 0, errors: [] as string[] }; | ||||||||||||||||||||||
| const BATCH_SIZE = 200; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
@@ -87,6 +91,7 @@ export async function GET(request: Request) { | |||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| if (scrapedData && scrapedData.length > 0) { | ||||||||||||||||||||||
| // Sequential processing: AI model calls must be serialized to avoid rate limits | ||||||||||||||||||||||
| for (const item of scrapedData) { | ||||||||||||||||||||||
| try { | ||||||||||||||||||||||
| let content = item.metadata?.content || item.summary || ''; | ||||||||||||||||||||||
|
|
@@ -141,6 +146,7 @@ export async function GET(request: Request) { | |||||||||||||||||||||
| .limit(BATCH_SIZE); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| if (userData && userData.length > 0) { | ||||||||||||||||||||||
| // Sequential processing: each item requires AI model call, processed one at a time to avoid rate limits | ||||||||||||||||||||||
| for (const item of userData) { | ||||||||||||||||||||||
| try { | ||||||||||||||||||||||
| const content = item.description || ''; | ||||||||||||||||||||||
|
|
@@ -186,6 +192,7 @@ export async function GET(request: Request) { | |||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| if (legacyData && legacyData.length > 0) { | ||||||||||||||||||||||
| // Sequential processing: each item requires AI model call, processed one at a time to avoid rate limits | ||||||||||||||||||||||
| for (const item of legacyData) { | ||||||||||||||||||||||
| try { | ||||||||||||||||||||||
| const content = item.detail_experience || item.summary || ''; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
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.
Suggestion: Changing this handler to POST breaks existing GET-based integrations (common for cron/scheduler triggers), causing those callers to receive method errors and stop processing. Keep backward compatibility by retaining a GET handler (or adding one that delegates to POST) if existing jobs still call this endpoint via GET. [api mismatch]
Severity Level: Major⚠️
Steps of Reproduction ✅
(Use Cmd/Ctrl + Click for best experience)
Prompt for AI Agent 🤖