MCPcopy
hub / github.com/graphql/graphiql / set

Method set

packages/graphiql-toolkit/src/storage/base.ts:109–132  ·  view source on GitHub ↗
(
    name: string,
    value: string,
  )

Source from the content-addressed store, hash-verified

107 }
108
109 set(
110 name: string,
111 value: string,
112 ): { isQuotaError: boolean; error: Error | null } {
113 let quotaError = false;
114 let error: Error | null = null;
115
116 if (this.storage) {
117 const key = `${STORAGE_NAMESPACE}:${name}`;
118 if (value) {
119 try {
120 this.storage.setItem(key, value);
121 } catch (e) {
122 error = e instanceof Error ? e : new Error(`${e}`);
123 quotaError = isQuotaError(this.storage, e);
124 }
125 } else {
126 // Clean up by removing the item if there's no value to set
127 this.storage.removeItem(key);
128 }
129 }
130
131 return { isQuotaError: quotaError, error };
132 }
133
134 clear() {
135 if (this.storage) {

Callers 15

pushMethod · 0.45
saveMethod · 0.45
uniqueByFunction · 0.45
_cacheSchemaMethod · 0.45
useThemeFunction · 0.45
setThemeFunction · 0.45
PluginContextProviderFunction · 0.45
mergeIncrementalResultFunction · 0.45
useDragResizeFunction · 0.45
useStoreTabsFunction · 0.45
clearHeadersFromTabsFunction · 0.45
setShouldPersistHeadersFunction · 0.45

Calls 1

isQuotaErrorFunction · 0.85

Tested by 4

getFragmentDefinitionsFunction · 0.36
getObjectTypeDefinitionsFunction · 0.36
changeFileMethod · 0.36
addFileMethod · 0.36