Skip to content

feature/autoSave (#582) - #6211

Merged
sid-bruno merged 5 commits into
mainfrom
feat/autosave-internal-582
Dec 2, 2025
Merged

sid-bruno merged 5 commits into
mainfrom
feat/autosave-internal-582

Conversation

@sid-bruno

@sid-bruno sid-bruno commented Nov 26, 2025 •

Copy link
Copy Markdown
Collaborator

Description

Extension of the base PR from #582

JIRA

Contribution Checklist:

  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.

Publishing to New Package Managers

Please see here for more information.

Summary by CodeRabbit

  • New Features

    • Auto Save feature added to preferences with enable/disable toggle and configurable delay interval
    • Automatically saves request changes and existing drafts at user-specified intervals (minimum 100ms)
    • Prevents data loss from unsaved work
    • Preferences UI includes new Save Delay control with validation
  • Tests

    • Added comprehensive autosave test coverage validating save behavior and draft persistence

✏️ Tip: You can customize this high-level summary in your review settings.

@github-actions

github-actions Bot commented Nov 26, 2025 •

Copy link
Copy Markdown

CLI Test Results

  1 files  ±0  140 suites  ±0   41s ⏱️ -17s
227 tests ±0  227 ✅ ±0  0 💤 ±0  0 ❌ ±0 
291 runs  ±0  290 ✅ ±0  1 💤 ±0  0 ❌ ±0 

Results for commit af707de. ± Comparison against base commit 786a341.

♻️ This comment has been updated with latest results.

@sid-bruno sid-bruno mentioned this pull request Dec 2, 2025
@coderabbitai

coderabbitai Bot commented Dec 2, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

This PR introduces an auto-save feature that periodically persists request and collection changes. It adds UI controls in preferences, a Redux middleware to debounce and schedule saves, modifies save actions to support silent mode (suppressing notifications), updates theme configurations, and includes comprehensive Playwright test coverage.

Changes

Cohort / File(s) Summary
Preferences UI & Configuration
packages/bruno-app/src/components/Preferences/General/index.js
Added Auto Save checkbox and Save Delay input field with validation schema (enabled boolean, interval numeric with 100 ms minimum), cross-field validation, and accessibility improvements.
Redux State & Configuration
packages/bruno-app/src/providers/ReduxStore/slices/app.js, packages/bruno-electron/src/store/preferences.js
Initialized autoSave state with enabled (default false) and interval (default 1000 ms) in both app slice and electron preferences; extended validation schema.
Autosave Middleware
packages/bruno-app/src/providers/ReduxStore/middlewares/autosave/middleware.js, packages/bruno-app/src/providers/ReduxStore/index.js
Implemented new autosave middleware that intercepts relevant actions, debounces saves per entity, respects preference settings, and integrates into Redux middleware chain.
Save Actions
packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js
Introduced optional silent parameter (default false) to saveRequest, saveFolderRoot, and saveCollectionSettings to conditionally suppress toast notifications.
Theme Updates
packages/bruno-app/src/themes/light.js, packages/bruno-app/src/themes/dark.js
Added preferences.sidebar.border styling to both light (#EFEFEF) and dark (#444444) themes.
Query URL Handler
packages/bruno-app/src/components/RequestPane/QueryUrl/index.js
Changed onSave callback to parameterless function while maintaining dispatch of saveRequest action.
Autosave Tests
tests/preferences/autosave/autosave.spec.ts
Added Playwright test suite covering autosave enablement, draft persistence, and behavior verification across request reopenings.

Sequence Diagram

sequenceDiagram
    participant User
    participant UI as Preferences UI
    participant Store as Redux Store
    participant Middleware as Autosave Middleware
    participant Actions as Save Actions
    participant FS as File System

    User->>UI: Enable Auto Save & set interval
    UI->>Store: dispatch updatePreferences
    Store->>Middleware: middleware receives action
    Middleware->>Middleware: enable autosave in config

    User->>UI: Edit request URL/name
    UI->>Store: dispatch action (updateRequest, etc.)
    Store->>Middleware: middleware intercepts
    Middleware->>Middleware: schedule debounced save<br/>(clear existing timer, start new)

    Note over Middleware: Wait for interval...
    Middleware->>Actions: dispatch saveRequest(uid, silent=true)
    Actions->>FS: persist changes to disk
    Actions->>Store: update state
    Note over UI: Draft indicator disappears
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

  • Autosave middleware logic: Verify timer management, debouncing correctness, and state inspection for drafts across collections/items
  • Silent parameter propagation: Confirm silent flag is consistently applied across all save action callsites and toast conditions
  • Validation schemas: Review autoSave validation rules (min 100 ms interval, required when enabled) in both app and electron preference files
  • Redux middleware integration: Ensure autosave middleware is correctly positioned in the chain and respects preference updates

Suggested reviewers

  • helloanoop
  • lohit-bruno
  • naman-bruno
  • bijin-bruno

Poem

🔄 Auto-save springs to life,
Drafts now dance without the strife,
Debounce whispers through the store,
Changes persist forevermore! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'feature/autoSave (#582)' is vague and generic, using a branch naming convention rather than a clear summary of the change. Reword to clearly describe the main feature, e.g., 'Add auto-save functionality with configurable intervals' or 'Implement auto-save middleware and preferences UI'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/autosave-internal-582

Comment @coderabbitai help to get the list of available commands and usage tips.

@sid-bruno
sid-bruno marked this pull request as ready for review December 2, 2025 08:22

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (7)
packages/bruno-app/src/providers/ReduxStore/middlewares/autosave/middleware.js (2)

4-75: Consider a more maintainable approach for action interception.

This hardcoded list of 71 action types is comprehensive but brittle. Adding new edit actions requires manually updating this array, which is easy to forget. Consider using a naming convention pattern (e.g., all actions starting with collections/) or tagging actions with metadata to automatically identify draft-creating actions.


136-154: Handle missing IDs gracefully.

If an intercepted action has an unexpected payload structure (missing itemUid, folderUid, and collectionUid), the code silently continues without scheduling a save. While this may be intentional, consider logging a warning in development to catch payload structure issues early.

packages/bruno-app/src/providers/ReduxStore/slices/app.js (1)

32-35: Consider a higher default autosave interval.

The default interval of 1000ms (1 second) may trigger frequent saves during active editing. While the UI enforces a minimum of 500ms, consider starting with 2-3 seconds for better balance between data safety and system load. Users can adjust based on their preference.

tests/preferences/autosave/autosave.spec.ts (4)

61-63: Replace fixed waitForTimeout calls with expectation‑driven waits

The three page.waitForTimeout(...) calls make the tests slower and more brittle than necessary. You can instead rely on Playwright’s built‑in polling on the draft indicator, e.g. let the expect(...).not.toBeVisible({ timeout: X }) assertion handle the autosave delay without an explicit sleep:

-      // Wait for autosave to trigger (interval + some buffer)
-      await page.waitForTimeout(1000);
-
-      // Verify draft indicator disappears after autosave
-      await expect(requestTab.locator('.has-changes-icon')).not.toBeVisible();
+      // Draft indicator should eventually disappear after autosave
+      await expect(requestTab.locator('.has-changes-icon')).not.toBeVisible({ timeout: 2000 });

and similarly for the other autosave waits. This keeps the intent clear while aligning with the guideline to avoid waitForTimeout where an expect can express the wait condition.

Also applies to: 112-114, 176-177


76-80: Prefer locator assertions over manual textContent reads for URL checks

For the final URL assertions you currently read textContent and then assert on the string. It’s more idiomatic (and avoids any string | null/typing edge cases) to assert directly on the locator text:

-      const urlEditor = page.locator('#request-url .CodeMirror');
-      const urlContent = await urlEditor.locator('.CodeMirror-line').first().textContent();
-      expect(urlContent).toContain('api.example.com/users');
+      const urlEditor = page.locator('#request-url .CodeMirror');
+      await expect(urlEditor).toContainText('api.example.com/users');

and similarly for 'api.example.com/existing-draft'. This also gives you built‑in polling if the editor text updates asynchronously.

Also applies to: 192-196


5-7: Consider centralizing autosave preference cleanup to avoid state leakage

The first test explicitly disables autosave at the end, but the second test leaves it enabled. If other specs assume a default disabled autosave state, this shared preference could leak across tests. Consider resetting the autosave preference in afterEach (via the same Preferences UI flow or a helper) so each test starts from a known baseline.

Also applies to: 82-99, 159-175, 197-197


21-30: Optionally extract common locators to constants for maintainability

Selectors like '#request-url .CodeMirror', the preferences trigger .status-bar button[data-trigger="preferences"], and the request tab locator pattern are repeated in several steps. Extracting them into well‑named constants at test scope (e.g. const urlEditor = page.locator('#request-url .CodeMirror'); once per test or helper const requestTab = (label: string) => page.locator('.request-tab').filter({ has: page.locator('.tab-label', { hasText: label }) });) would reduce duplication and make selector changes easier to manage later.

Also applies to: 50-60, 101-111, 136-145, 147-157, 180-181

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 786a341 and be94224.

📒 Files selected for processing (11)
  • packages/bruno-app/src/components/Preferences/General/index.js (4 hunks)
  • packages/bruno-app/src/components/RequestPane/QueryUrl/index.js (1 hunks)
  • packages/bruno-app/src/components/RequestPane/Vars/index.js (1 hunks)
  • packages/bruno-app/src/providers/ReduxStore/index.js (1 hunks)
  • packages/bruno-app/src/providers/ReduxStore/middlewares/autosave/middleware.js (1 hunks)
  • packages/bruno-app/src/providers/ReduxStore/slices/app.js (1 hunks)
  • packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js (6 hunks)
  • packages/bruno-app/src/themes/dark.js (1 hunks)
  • packages/bruno-app/src/themes/light.js (1 hunks)
  • packages/bruno-electron/src/store/preferences.js (2 hunks)
  • tests/preferences/autosave/autosave.spec.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (CODING_STANDARDS.md)

**/*.{js,jsx,ts,tsx}: Use 2 spaces for indentation. No tabs, just spaces
Stick to single quotes for strings
Always add semicolons at the end of statements
No trailing commas
Always use parentheses around parameters in arrow functions, even for single parameters
For multiline constructs, put opening braces on the same line, and ensure consistency. Minimum 2 elements for multiline
No newlines inside function parentheses. Keep 'em tight
Space before and after the arrow in arrow functions. () => {} is good
No space between function name and parentheses. func() not func ()
Semicolons go at the end of the line, not on a new line
Names for functions need to be concise and descriptive
Add in JSDoc comments to add more details to the abstractions if needed
Avoid single line abstractions where all that's being done is increasing the call stack with one additional function
Add in meaningful comments instead of obvious ones where complex code flow is explained properly

Files:

  • packages/bruno-app/src/providers/ReduxStore/index.js
  • packages/bruno-electron/src/store/preferences.js
  • packages/bruno-app/src/components/RequestPane/Vars/index.js
  • tests/preferences/autosave/autosave.spec.ts
  • packages/bruno-app/src/providers/ReduxStore/middlewares/autosave/middleware.js
  • packages/bruno-app/src/components/Preferences/General/index.js
  • packages/bruno-app/src/providers/ReduxStore/slices/app.js
  • packages/bruno-app/src/themes/dark.js
  • packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js
  • packages/bruno-app/src/themes/light.js
  • packages/bruno-app/src/components/RequestPane/QueryUrl/index.js
tests/**/**.*

⚙️ CodeRabbit configuration file

tests/**/**.*: Review the following e2e test code written using the Playwright test library. Ensure that:

  • Follow best practices for Playwright code and e2e automation

  • Try to reduce usage of page.waitForTimeout(); in code unless absolutely necessary and the locator cannot be found using existing expect() playwright calls

  • Avoid using page.pause() in code

  • Use locator variables for locators

  • Avoid using test.only

  • Use multiple assertions

  • Promote the use of test.step as much as possible so the generated reports are easier to read

  • Ensure that the fixtures like the collections are nested inside the fixtures folder

    Fixture Example*: Here's an example of possible fixture and test pair

    .
    ├── fixtures
    │   └── collection
    │       ├── base.bru
    │       ├── bruno.json
    │       ├── collection.bru
    │       ├── ws-test-request-with-headers.bru
    │       ├── ws-test-request-with-subproto.bru
    │       └── ws-test-request.bru
    ├── connection.spec.ts # <- Depends on the collection in ./fixtures/collection
    ├── headers.spec.ts
    ├── persistence.spec.ts
    ├── variable-interpolation
    │   ├── fixtures
    │   │   └── collection
    │   │       ├── environments
    │   │       ├── bruno.json
    │   │       └── ws-interpolation-test.bru
    │   ├── init-user-data
    │   └── variable-interpolation.spec.ts # <- Depends on the collection in ./variable-interpolation/fixtures/collection
    └── subproto.spec.ts
    

Files:

  • tests/preferences/autosave/autosave.spec.ts
🧬 Code graph analysis (3)
packages/bruno-app/src/providers/ReduxStore/index.js (2)
packages/bruno-app/src/providers/App/useTelemetry.js (1)
  • isDevEnv (21-23)
packages/bruno-app/src/providers/ReduxStore/middlewares/draft/middleware.js (2)
  • draftDetectMiddleware (76-82)
  • draftDetectMiddleware (76-82)
packages/bruno-app/src/providers/ReduxStore/middlewares/autosave/middleware.js (1)
packages/bruno-js/src/sandbox/quickjs/shims/bruno-request.js (1)
  • setTimeout (115-117)
packages/bruno-app/src/components/RequestPane/QueryUrl/index.js (8)
packages/bruno-app/src/components/RequestPane/GrpcQueryUrl/index.js (1)
  • onSave (87-89)
packages/bruno-app/src/components/RequestPane/QueryParams/index.js (1)
  • onSave (42-42)
packages/bruno-app/src/components/CollectionSettings/Vars/VarsTable/index.js (1)
  • onSave (31-31)
packages/bruno-app/src/components/FolderSettings/Vars/VarsTable/index.js (1)
  • onSave (28-28)
packages/bruno-app/src/components/RequestPane/Vars/VarsTable/index.js (1)
  • onSave (30-30)
packages/bruno-app/src/components/RequestPane/RequestHeaders/index.js (1)
  • onSave (35-35)
packages/bruno-app/src/components/RequestPane/GraphQLVariables/index.js (1)
  • onSave (48-48)
packages/bruno-app/src/components/RequestPane/GraphQLRequestPane/index.js (1)
  • onSave (52-52)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: SSL Tests - Windows
  • GitHub Check: SSL Tests - macOS
  • GitHub Check: SSL Tests - Linux
  • GitHub Check: Playwright E2E Tests
  • GitHub Check: Unit Tests
  • GitHub Check: CLI Tests
🔇 Additional comments (14)
packages/bruno-app/src/themes/light.js (1)

558-562: Additive theme preference looks good

preferences.sidebar.border is added in a way that’s consistent with the existing theme shape and styling in this file and matches the new dark theme counterpart, so consumers of preferences.sidebar.border will have coverage for both themes.

packages/bruno-app/src/themes/dark.js (1)

548-552: Symmetric preferences addition for dark theme

preferences.sidebar.border is added with a value consistent with the dark palette and mirrors the light theme’s new preferences shape, keeping the public theme API aligned across themes.

packages/bruno-app/src/providers/ReduxStore/middlewares/autosave/middleware.js (2)

93-117: LGTM! Bulk draft handling is well-designed.

The saveExistingDrafts function correctly identifies drafts across collections, requests, and folders, and schedules debounced saves with the silent flag to avoid notification spam. The use of the helper functions maintains consistency with the codebase.


78-90: No action needed on timer cleanup.

The module-level pendingTimers object is safe in this context. The autosave middleware is instantiated once when the Redux store is created and never recreated. The existing logic properly manages timers by clearing any previous timer for a key before scheduling a new one, and deleting the timer reference after execution. There is no HMR middleware recreation scenario that would cause stale closures.

packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js (3)

97-135: LGTM! Silent parameter implementation is clean.

The silent parameter correctly suppresses success toasts while preserving error notifications. The default value maintains backward compatibility with existing callers.


199-242: Consistent implementation with saveRequest.

The saveFolderRoot changes mirror the saveRequest pattern, maintaining consistency across the codebase.


2133-2172: Completes the silent parameter pattern.

All three save functions (saveRequest, saveFolderRoot, saveCollectionSettings) now consistently support silent mode, enabling the autosave middleware to persist changes without UI noise.

packages/bruno-app/src/providers/ReduxStore/index.js (1)

12-21: Middleware integration looks correct.

The autosaveMiddleware is properly placed after draftDetectMiddleware in the chain, ensuring drafts are created before autosave attempts to persist them.

packages/bruno-app/src/components/RequestPane/QueryUrl/index.js (1)

36-38: Clean removal of unused parameter.

The finalValue parameter was never used in onSave, so removing it is appropriate. The callback at line 113 still passes the argument, but it's safely ignored.

packages/bruno-app/src/components/Preferences/General/index.js (4)

40-58: Validation schema is well-designed.

The schema correctly handles edge cases:

  • Transforms empty strings to undefined for proper validation
  • Validates interval as a number ≥ 500ms
  • Requires interval when autosave is enabled via custom test
  • Clear error messages for each validation rule

75-78: Data handling is correct.

Initial values properly extract autoSave preferences with safe defaults, and handleSave correctly includes them in the persisted preferences.

Also applies to: 109-112


118-118: Good attention to consistency.

Adding the period to the success message maintains consistent punctuation across toast notifications.


321-321: Improved testability and accessibility.

Adding id="defaultCollectionLocation" improves both automated testing selectors and screen reader navigation.

tests/preferences/autosave/autosave.spec.ts (1)

4-122: Solid end‑to‑end coverage and good use of Playwright primitives

Nice use of test.step, shared helpers (createCollection, createRequest, closeAllCollections), and multiple assertions to exercise both autosave enabled/disabled flows and persistence across tab reopen. Structure and locator usage are generally clean and follow the Playwright guidelines.

Also applies to: 124-197

@sid-bruno
sid-bruno force-pushed the feat/autosave-internal-582 branch from 23b09c2 to af707de Compare December 2, 2025 08:39

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (1)
packages/bruno-app/src/providers/ReduxStore/middlewares/autosave/middleware.js (1)

119-139: Disable-branch is unreachable due to early return when autosave is off

On Line 125 you return early when !autoSave?.enabled, so the later app/updatePreferences branch that clears pendingTimers (Lines 133-139) will never run when the user disables autosave. Timers for already-scheduled saves will keep firing after autosave is turned off, which is exactly what the earlier review comment warned about.

You can fix this by handling app/updatePreferences before the enabled check, e.g.:

 export const autosaveMiddleware = ({ dispatch, getState }) => (next) => (action) => {
   // Let the action update the state first
   const result = next(action);
 
-  // Check if autosave is enabled
-  const { autoSave } = getState().app.preferences;
-  if (!autoSave?.enabled) return result;
-
-  // When autosave is enabled (or settings change), save any existing drafts
-  if (action.type === 'app/updatePreferences' && action.payload?.autoSave?.enabled) {
-    saveExistingDrafts(dispatch, getState, autoSave.interval);
-    return result;
-  }
-
-  if (action.type === 'app/updatePreferences' && action.payload?.autoSave?.enabled === false) {
-    Object.keys(pendingTimers).forEach((key) => {
-      clearTimeout(pendingTimers[key]);
-      delete pendingTimers[key];
-    });
-    return result;
-  }
+  const { autoSave } = getState().app.preferences;
+
+  if (action.type === 'app/updatePreferences') {
+    if (action.payload?.autoSave?.enabled === false) {
+      Object.keys(pendingTimers).forEach((key) => {
+        clearTimeout(pendingTimers[key]);
+        delete pendingTimers[key];
+      });
+      return result;
+    }
+
+    if (autoSave?.enabled && action.payload?.autoSave?.enabled) {
+      saveExistingDrafts(dispatch, getState, autoSave.interval);
+      return result;
+    }
+  }
+
+  // Check if autosave is enabled
+  if (!autoSave?.enabled) return result;

This ensures:

  • Disabling autosave always clears and stops pending timers.
  • Enabling (or re-enabling) autosave still triggers saveExistingDrafts.
  • Other actions still short‑circuit when autosave is off.
🧹 Nitpick comments (2)
packages/bruno-app/src/components/Preferences/General/index.js (1)

280-310: UI controls are well-implemented with good accessibility.

The auto-save controls are properly structured with:

  • Checkbox and input linked via id/htmlFor
  • Conditional disabled state on the interval input
  • Visual feedback via opacity when disabled

Minor consistency note: line 293 uses opacity-50 for the disabled state, while other disabled field groups in this file (CA certificate at lines 179, 196, etc.) use opacity-25. Consider standardizing to opacity-25 for consistency, though this is purely a visual polish item.

packages/bruno-app/src/providers/ReduxStore/middlewares/autosave/middleware.js (1)

144-162: Defensive destructuring from action.payload to avoid runtime errors

Line 144 destructures from action.payload without a default. If any of the actionsToIntercept ever fires with a missing or undefined payload, this middleware will throw before it can fall through. Even if current actions always supply payloads, this is fragile for future additions.

A small defensive tweak keeps behavior identical when payload exists:

-  const { itemUid, folderUid, collectionUid } = action.payload;
+  const { itemUid, folderUid, collectionUid } = action.payload || {};

Please double‑check that all currently intercepted actions indeed carry these fields; if any don’t, this change also prevents hard‑to‑trace crashes when you add them to actionsToIntercept later.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between be94224 and af707de.

📒 Files selected for processing (2)
  • packages/bruno-app/src/components/Preferences/General/index.js (4 hunks)
  • packages/bruno-app/src/providers/ReduxStore/middlewares/autosave/middleware.js (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (CODING_STANDARDS.md)

**/*.{js,jsx,ts,tsx}: Use 2 spaces for indentation. No tabs, just spaces
Stick to single quotes for strings
Always add semicolons at the end of statements
No trailing commas
Always use parentheses around parameters in arrow functions, even for single parameters
For multiline constructs, put opening braces on the same line, and ensure consistency. Minimum 2 elements for multiline
No newlines inside function parentheses. Keep 'em tight
Space before and after the arrow in arrow functions. () => {} is good
No space between function name and parentheses. func() not func ()
Semicolons go at the end of the line, not on a new line
Names for functions need to be concise and descriptive
Add in JSDoc comments to add more details to the abstractions if needed
Avoid single line abstractions where all that's being done is increasing the call stack with one additional function
Add in meaningful comments instead of obvious ones where complex code flow is explained properly

Files:

  • packages/bruno-app/src/components/Preferences/General/index.js
  • packages/bruno-app/src/providers/ReduxStore/middlewares/autosave/middleware.js
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: CLI Tests
  • GitHub Check: Playwright E2E Tests
  • GitHub Check: Unit Tests
  • GitHub Check: SSL Tests - Windows
  • GitHub Check: SSL Tests - macOS
  • GitHub Check: SSL Tests - Linux
🔇 Additional comments (4)
packages/bruno-app/src/components/Preferences/General/index.js (3)

40-58: LGTM! Validation schema is well-structured.

The autoSave validation correctly handles:

  • Empty string transformation to undefined for numeric validation
  • Minimum interval of 100ms (reasonable for auto-save)
  • Cross-field validation ensuring interval is required when auto-save is enabled

311-316: Error display correctly handles both validation levels.

The implementation now properly displays both object-level errors (line 311-313) and property-level errors (line 314-316), addressing the past review comment. The logic correctly distinguishes between:

  • Object-level validation failure (autoSave as string)
  • Property-level validation failure (autoSave.interval as string)

These are mutually exclusive with abortEarly: true, ensuring clean error messaging.


75-78: LGTM! Auto-save preferences correctly integrated.

Initial values provide sensible defaults (enabled: false, interval: 1000ms), and the save handler properly persists the autoSave configuration to the Redux store.

Also applies to: 109-112

packages/bruno-app/src/providers/ReduxStore/middlewares/autosave/middleware.js (1)

77-117: Autosave scheduling and draft sweep look solid

The pendingTimers map, scheduleAutoSave, and saveExistingDrafts (Lines 77-117) are clean and predictable: per-entity keys prevent cross-talk between timers, and the draft sweep correctly differentiates between collection, request, and folder saves while using the silent variants of the save actions. No changes needed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants