button "save" feedback#62
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughA filter persistence feature is added: the backend saves serial filter configuration with error handling, while the webview adds a save button with CSS feedback styling, sends the filter data, receives the response, and displays timed success or error messages to the user. ChangesFilter Save Persistence and Feedback
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/webviewPanel.ts (1)
2180-2190:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winAdd a safety timeout to re-enable the save button.
If the
filtersSavedmessage never arrives due to an IPC failure, the button remains disabled indefinitely. Consider adding a safety timeout (e.g., 5 seconds) to re-enable the button even if no response is received.🛡️ Proposed fix to add safety timeout
+ var filterSaveFailsafeTimer = null; filterSaveBtn.addEventListener('click', () => { filterSaveBtn.disabled = true; + // Safety timeout in case the message never arrives + if (filterSaveFailsafeTimer) { clearTimeout(filterSaveFailsafeTimer); } + filterSaveFailsafeTimer = setTimeout(function() { + filterSaveBtn.disabled = false; + filterSaveBtn.textContent = filterSaveOriginalLabel; + filterSaveFailsafeTimer = null; + }, 5000); vscode.postMessage({ type: 'saveFilters', timestamp: filterState.timestamp, suppressPattern: filterState.suppressPattern, highlightPattern: filterState.highlightPattern, dedupPattern: filterState.dedupPattern, dedupThreshold: filterState.dedupThreshold, }); });And clear it in
showFilterSaveFeedback:function showFilterSaveFeedback(ok, errorText) { + if (filterSaveFailsafeTimer) { + clearTimeout(filterSaveFailsafeTimer); + filterSaveFailsafeTimer = null; + } if (filterSaveFeedbackTimer) {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/webviewPanel.ts` around lines 2180 - 2190, When handling filterSaveBtn click (inside the listener that calls vscode.postMessage), add a safety timeout (e.g., 5000ms) that will re-enable filterSaveBtn and clear any stored timeout id if no response arrives; store the timer id in a module-scoped variable (e.g., filterSaveTimeout) and clear any existing timer before setting a new one to avoid duplicates. In showFilterSaveFeedback, clearTimeout(filterSaveTimeout) and set filterSaveTimeout = undefined so the normal response path cancels the safety fallback; ensure the re-enable logic mirrors the existing successful-response behavior so the button state is always reset.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/webviewPanel.ts`:
- Around line 1321-1330: Replace the hardcoded white text color in the CSS rules
for button.feedback-saved and button.feedback-error by using a theme variable
(e.g. var(--btn-fg) or another VS Code button foreground like
var(--vscode-button-foreground)) instead of "`#ffffff`", and remove the color: ...
!important to rely on selector specificity (keep the existing selector
button.feedback-saved / button.feedback-error to increase specificity) so the
theme-controlled variable determines foreground color across light/dark themes.
---
Outside diff comments:
In `@src/webviewPanel.ts`:
- Around line 2180-2190: When handling filterSaveBtn click (inside the listener
that calls vscode.postMessage), add a safety timeout (e.g., 5000ms) that will
re-enable filterSaveBtn and clear any stored timeout id if no response arrives;
store the timer id in a module-scoped variable (e.g., filterSaveTimeout) and
clear any existing timer before setting a new one to avoid duplicates. In
showFilterSaveFeedback, clearTimeout(filterSaveTimeout) and set
filterSaveTimeout = undefined so the normal response path cancels the safety
fallback; ensure the re-enable logic mirrors the existing successful-response
behavior so the button state is always reset.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 0493fc98-2b58-445b-81bb-dbf1d50ff146
📒 Files selected for processing (2)
.gitignoresrc/webviewPanel.ts
Summary by CodeRabbit
Release Notes
New Features
Chores