Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: introduce writable handles to signify updates to handle ref…
…erences A special list of writable handles is compiled in a list while issuing handles (request/collection creation, etc). Instead of manually computing the tab and toggling the dirty state, the writable handle is updated (changing the type to invalid on request deletion) and the tab with the request open can infer it via the update reflected in the request handle under the tab save context (reactive update trigger).
- Loading branch information
1 parent
854ffa2
commit 3c0af78
Showing
7 changed files
with
195 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 8 additions & 1 deletion
9
packages/hoppscotch-common/src/services/new-workspace/handle.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
import { Ref } from "vue" | ||
import { Ref, WritableComputedRef } from "vue" | ||
|
||
export type HandleRef<T, InvalidateReason = unknown> = Ref< | ||
{ type: "ok"; data: T } | { type: "invalid"; reason: InvalidateReason } | ||
> | ||
|
||
export type WritableHandleRef< | ||
T, | ||
InvalidateReason = unknown, | ||
> = WritableComputedRef< | ||
{ type: "ok"; data: T } | { type: "invalid"; reason: InvalidateReason } | ||
> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.