File tree Expand file tree Collapse file tree 1 file changed +2
-18
lines changed
packages/sds/src/message_channel Expand file tree Collapse file tree 1 file changed +2
-18
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ export interface HistoryStorage {
1212export interface PersistentHistoryOptions {
1313 channelId : ChannelId ;
1414 storage ?: HistoryStorage ;
15- storageKeyPrefix ?: string ;
1615}
1716
1817type StoredHistoryEntry = {
@@ -45,8 +44,8 @@ export class PersistentHistory implements ILocalHistory {
4544
4645 public constructor ( options : PersistentHistoryOptions ) {
4746 this . memory = new MemLocalHistory ( ) ;
48- this . storage = options . storage ?? getDefaultHistoryStorage ( ) ;
49- this . storageKey = `${ HISTORY_STORAGE_PREFIX } ${ options . storageKeyPrefix } : ${ options . channelId } ` ;
47+ this . storage = options . storage || localStorage ;
48+ this . storageKey = `${ HISTORY_STORAGE_PREFIX } ${ options . channelId } ` ;
5049 this . load ( ) ;
5150 }
5251
@@ -132,21 +131,6 @@ export class PersistentHistory implements ILocalHistory {
132131 }
133132}
134133
135- export const getDefaultHistoryStorage = ( ) : HistoryStorage | undefined => {
136- try {
137- if ( typeof localStorage === "undefined" ) {
138- return undefined ;
139- }
140-
141- const probeKey = `${ HISTORY_STORAGE_PREFIX } __probe__` ;
142- localStorage . setItem ( probeKey , probeKey ) ;
143- localStorage . removeItem ( probeKey ) ;
144- return localStorage ;
145- } catch {
146- return undefined ;
147- }
148- } ;
149-
150134const serializeHistoryEntry = ( entry : HistoryEntry ) : StoredHistoryEntry => ( {
151135 messageId : entry . messageId ,
152136 retrievalHint : entry . retrievalHint
You can’t perform that action at this time.
0 commit comments