[PR #5918] feat: auto-save requests when enabled in settings (#3437) #5418

Open
opened 2026-03-17 02:52:02 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/5918
Author: @GaneshAdimalupu
Created: 2/28/2026
Status: 🔄 Open

Base: mainHead: main


📝 Commits (10+)

  • 51ac59b feat: auto-save requests when enabled in settings (#3437)
  • 3b8a6c1 Merge branch 'hoppscotch:main' into main
  • a81e56c Update packages/hoppscotch-common/src/components/http/Request.vue
  • 08a5ffe fix: resolve auto-save debounce and silent-save issues
  • 3aefeeb Merge pull request #1 from GaneshAdimalupu/fix/auto-save-debounce-and-silent-save
  • 073c14d Potential fix for pull request finding
  • 94ce5f5 fix(autosave): fix GQL tab mismatch, stale ref, analytics inflation, input clamping
  • bb10094 fix(autosave): guard modal triggers and catch block behind silent flag in REST
  • 846a812 fix(autosave): gate all error toasts and modals behind silent flag, fix saveInProgress race
  • b94360c fix(autosave): await mutation, fix saveInProgress race and recovery path, guard GQL modal

📊 Changes

6 files changed (+609 additions, -130 deletions)

View changed files

📝 packages/hoppscotch-common/locales/en.json (+4 -0)
📝 packages/hoppscotch-common/src/components/graphql/RequestOptions.vue (+281 -29)
📝 packages/hoppscotch-common/src/components/http/Request.vue (+253 -100)
📝 packages/hoppscotch-common/src/newstore/settings.ts (+6 -0)
📝 packages/hoppscotch-common/src/pages/settings.vue (+62 -1)
📝 packages/hoppscotch-common/src/services/persistence/validation-schemas/index.ts (+3 -0)

📄 Description

Closes #3437

Adds an optional auto-save feature for request tabs: when "Auto-save requests" is enabled in Settings → General, requests that are already saved to a collection (or team) are saved automatically after a configurable delay. Auto-save is silent (no toast); manual Save still shows "Request saved". Applies to REST and GraphQL, user and team collections.

What's changed

  • Settings: added AUTO_SAVE_REQUESTS and AUTO_SAVE_DELAY_MS (store, persistence schema, Settings UI, i18n in en.json)
  • REST: debounced auto-save in Request.vue with silent toast, save-in-flight guard, and team save error handling
  • GraphQL: same pattern in RequestOptions.vue plus team-collection save path (was missing)
  • Only runs when tab has saveContext; no modal from auto-save; manual Save unchanged

Notes to reviewers

@liyasthomas

  • Default is off; delay is 500–10000 ms (default 2000). Manual QA: enable in Settings, edit a saved request, wait for delay, confirm dot clears and no toast.
image

Summary by cubic

Adds optional per-tab auto-save for saved REST and GraphQL requests. When enabled, edits save silently after you stop typing, with a configurable 500–10000 ms delay.

  • New Features

    • Settings: AUTO_SAVE_REQUESTS toggle and AUTO_SAVE_DELAY_MS (500–10000 ms, default 2000) with UI hint, clamped input, and persistence schema validation.
    • Auto-save: Debounced per-tab silent saves for REST & GraphQL when a tab has a saveContext. Concurrent saves are serialized; manual saves queue and run after the current save. Works for user and team collections.
  • Bug Fixes

    • Concurrency & stability: Set saveInProgress before auth/network to close races; snapshot request before mutation and clear isDirty only if unchanged; re-verify saveContext after auth; queue manual saves if one is in-flight; exponential backoff on failures (2s → 4s → 8s, max 3) only when no new edits occurred; trigger a follow-up silent save only if edits changed during an in-flight save; reset/cancel retry timers and debounced watchers on new edits and unmount; stop retries if a tab is closed or component is unmounted (explicit unmounted flag in GQL); never log analytics or show toasts for auto-saves.
    • REST: Silent team saves use lightweight isValidUser; manual saves only when the invoking tab is active; errors/modals gated behind the silent flag; “Save As” uses a separate saveAsRequest; result view scoped to the tab’s ID.
    • GraphQL: Scoped saves to the component’s tab to avoid tab mismatches and stale refs; silent team saves use lightweight isValidUser; manual saves only when the saving tab is active; errors/modals gated behind the silent flag; prevent actions after component destruction with an unmounted guard.

Written for commit 4eed44a7ff. Summary will update on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hoppscotch/hoppscotch/pull/5918 **Author:** [@GaneshAdimalupu](https://github.com/GaneshAdimalupu) **Created:** 2/28/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (10+) - [`51ac59b`](https://github.com/hoppscotch/hoppscotch/commit/51ac59b2b77c73e22668f16592d12a751d6682ab) feat: auto-save requests when enabled in settings (#3437) - [`3b8a6c1`](https://github.com/hoppscotch/hoppscotch/commit/3b8a6c1c89a2990f792b8bba5982502a27788fc3) Merge branch 'hoppscotch:main' into main - [`a81e56c`](https://github.com/hoppscotch/hoppscotch/commit/a81e56c986a6e132512b97882ca7add801f37455) Update packages/hoppscotch-common/src/components/http/Request.vue - [`08a5ffe`](https://github.com/hoppscotch/hoppscotch/commit/08a5ffec0cbe89b4e9b0e66a89c6ea104d59770b) fix: resolve auto-save debounce and silent-save issues - [`3aefeeb`](https://github.com/hoppscotch/hoppscotch/commit/3aefeeb545ad5806bafddb8b0f18cd8175ca619c) Merge pull request #1 from GaneshAdimalupu/fix/auto-save-debounce-and-silent-save - [`073c14d`](https://github.com/hoppscotch/hoppscotch/commit/073c14d09395edd10185f5bbd09af7a861db625c) Potential fix for pull request finding - [`94ce5f5`](https://github.com/hoppscotch/hoppscotch/commit/94ce5f578eda5c006c0400a3de7225891e677bb0) fix(autosave): fix GQL tab mismatch, stale ref, analytics inflation, input clamping - [`bb10094`](https://github.com/hoppscotch/hoppscotch/commit/bb1009477188f308293cab609394c688b7228ee0) fix(autosave): guard modal triggers and catch block behind silent flag in REST - [`846a812`](https://github.com/hoppscotch/hoppscotch/commit/846a812e66b45ba836081bfdae6f166234765bd4) fix(autosave): gate all error toasts and modals behind silent flag, fix saveInProgress race - [`b94360c`](https://github.com/hoppscotch/hoppscotch/commit/b94360cf48e80065211ef3c4d0d048c3df512500) fix(autosave): await mutation, fix saveInProgress race and recovery path, guard GQL modal ### 📊 Changes **6 files changed** (+609 additions, -130 deletions) <details> <summary>View changed files</summary> 📝 `packages/hoppscotch-common/locales/en.json` (+4 -0) 📝 `packages/hoppscotch-common/src/components/graphql/RequestOptions.vue` (+281 -29) 📝 `packages/hoppscotch-common/src/components/http/Request.vue` (+253 -100) 📝 `packages/hoppscotch-common/src/newstore/settings.ts` (+6 -0) 📝 `packages/hoppscotch-common/src/pages/settings.vue` (+62 -1) 📝 `packages/hoppscotch-common/src/services/persistence/validation-schemas/index.ts` (+3 -0) </details> ### 📄 Description **Closes #3437** Adds an optional auto-save feature for request tabs: when "Auto-save requests" is enabled in Settings → General, requests that are already saved to a collection (or team) are saved automatically after a configurable delay. Auto-save is silent (no toast); manual Save still shows "Request saved". Applies to REST and GraphQL, user and team collections. ### What's changed - [x] Settings: added `AUTO_SAVE_REQUESTS` and `AUTO_SAVE_DELAY_MS` (store, persistence schema, Settings UI, i18n in en.json) - [x] REST: debounced auto-save in `Request.vue` with silent toast, save-in-flight guard, and team save error handling - [x] GraphQL: same pattern in `RequestOptions.vue` plus team-collection save path (was missing) - [x] Only runs when tab has saveContext; no modal from auto-save; manual Save unchanged ### Notes to reviewers @liyasthomas - Default is off; delay is 500–10000 ms (default 2000). Manual QA: enable in Settings, edit a saved request, wait for delay, confirm dot clears and no toast. <img width="1532" height="782" alt="image" src="https://github.com/user-attachments/assets/4f919897-88d5-49b3-9f92-e97ee5f6d596" /> <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds optional per-tab auto-save for saved REST and GraphQL requests. When enabled, edits save silently after you stop typing, with a configurable 500–10000 ms delay. - **New Features** - Settings: `AUTO_SAVE_REQUESTS` toggle and `AUTO_SAVE_DELAY_MS` (500–10000 ms, default 2000) with UI hint, clamped input, and persistence schema validation. - Auto-save: Debounced per-tab silent saves for REST & GraphQL when a tab has a saveContext. Concurrent saves are serialized; manual saves queue and run after the current save. Works for user and team collections. - **Bug Fixes** - Concurrency & stability: Set `saveInProgress` before auth/network to close races; snapshot request before mutation and clear `isDirty` only if unchanged; re-verify `saveContext` after auth; queue manual saves if one is in-flight; exponential backoff on failures (2s → 4s → 8s, max 3) only when no new edits occurred; trigger a follow-up silent save only if edits changed during an in-flight save; reset/cancel retry timers and debounced watchers on new edits and unmount; stop retries if a tab is closed or component is unmounted (explicit unmounted flag in GQL); never log analytics or show toasts for auto-saves. - REST: Silent team saves use lightweight `isValidUser`; manual saves only when the invoking tab is active; errors/modals gated behind the silent flag; “Save As” uses a separate `saveAsRequest`; result view scoped to the tab’s ID. - GraphQL: Scoped saves to the component’s tab to avoid tab mismatches and stale refs; silent team saves use lightweight `isValidUser`; manual saves only when the saving tab is active; errors/modals gated behind the silent flag; prevent actions after component destruction with an unmounted guard. <sup>Written for commit 4eed44a7ff93bcf7bf42ae8bf79c406d9cd60d82. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#5418
No description provided.