Files
hikari-desktop/src/lib/stores/historyRestore.ts
T
naomi 2d3adcab1c
Security Scan and Upload / Security & DefectDojo Upload (push) Successful in 52s
CI / Lint & Test (push) Successful in 14m15s
CI / Build Linux (push) Successful in 16m37s
CI / Build Windows (cross-compile) (push) Successful in 26m35s
feat: add chat modes and interrupt feature (#46)
### Explanation

_No response_

### Issue

Closes #40

### Attestations

- [ ] I have read and agree to the [Code of Conduct](https://docs.nhcarrigan.com/community/coc/)
- [ ] I have read and agree to the [Community Guidelines](https://docs.nhcarrigan.com/community/guide/).
- [ ] My contribution complies with the [Contributor Covenant](https://docs.nhcarrigan.com/dev/covenant/).

### Dependencies

- [ ] I have pinned the dependencies to a specific patch version.

### Style

- [ ] I have run the linter and resolved any errors.
- [ ] My pull request uses an appropriate title, matching the conventional commit standards.
- [ ] My scope of feat/fix/chore/etc. correctly matches the nature of changes in my pull request.

### Tests

- [ ] My contribution adds new code, and I have added tests to cover it.
- [ ] My contribution modifies existing code, and I have updated the tests to reflect these changes.
- [ ] All new and existing tests pass locally with my changes.
- [ ] Code coverage remains at or above the configured threshold.

### Documentation

_No response_

### Versioning

_No response_

Reviewed-on: #46
Co-authored-by: Naomi Carrigan <commits@nhcarrigan.com>
Co-committed-by: Naomi Carrigan <commits@nhcarrigan.com>
2026-01-20 08:33:39 -08:00

30 lines
889 B
TypeScript

// Separate module for history restoration to ensure persistence across reconnects
let shouldRestore = false;
let savedHistory: string | null = null;
export function setShouldRestoreHistory(should: boolean) {
shouldRestore = should;
console.log("Setting shouldRestoreHistory to:", should);
}
export function setSavedHistory(history: string | null) {
savedHistory = history;
console.log("Setting savedHistory, length:", history?.length || 0);
}
export function getShouldRestoreHistory(): boolean {
console.log("Getting shouldRestoreHistory:", shouldRestore);
return shouldRestore;
}
export function getSavedHistory(): string | null {
console.log("Getting savedHistory, length:", savedHistory?.length || 0);
return savedHistory;
}
export function clearHistoryRestore() {
console.log("Clearing history restore flags");
shouldRestore = false;
savedHistory = null;
}