(prefix: string)
| 249 | } |
| 250 | |
| 251 | function getSettingsPrefixAtom(prefix: string): Atom<SettingsType> { |
| 252 | if (isPreviewWindow()) return NullAtom as Atom<SettingsType>; |
| 253 | let settingsPrefixAtom = settingsAtomCache.get(prefix + ":"); |
| 254 | if (settingsPrefixAtom == null) { |
| 255 | // create a stable, closured reference to use as the deepCompareReturnPrev key |
| 256 | const cacheKey = {}; |
| 257 | settingsPrefixAtom = atom((get) => { |
| 258 | const settings = get(atoms.settingsAtom); |
| 259 | const newValue = getPrefixedSettings(settings, prefix); |
| 260 | return deepCompareReturnPrev(cacheKey, newValue); |
| 261 | }); |
| 262 | settingsAtomCache.set(prefix + ":", settingsPrefixAtom); |
| 263 | } |
| 264 | return settingsPrefixAtom; |
| 265 | } |
| 266 | |
| 267 | function getSingleBlockAtomCache(blockId: string): Map<string, Atom<any>> { |
| 268 | const blockORef = WOS.makeORef("block", blockId); |
no test coverage detected