MCPcopy Create free account
hub / github.com/ReactTooltip/react-tooltip / refreshEntry

Function refreshEntry

src/components/Tooltip/anchor-registry.ts:47–67  ·  view source on GitHub ↗
(selector: string, entry: AnchorRegistryEntry)

Source from the content-addressed store, hash-verified

45}
46
47function refreshEntry(selector: string, entry: AnchorRegistryEntry) {
48 const nextState = readAnchorsForSelector(selector)
49 const nextErrorMessage = nextState.error?.message ?? null
50 const previousErrorMessage = entry.error?.message ?? null
51
52 if (
53 areAnchorListsEqual(entry.anchors, nextState.anchors) &&
54 nextErrorMessage === previousErrorMessage
55 ) {
56 return
57 }
58
59 const nextEntry = {
60 ...entry,
61 anchors: nextState.anchors,
62 error: nextState.error,
63 }
64
65 registry.set(selector, nextEntry)
66 notifySubscribers(nextEntry)
67}
68
69function refreshAllEntries() {
70 registry.forEach((entry, selector) => {

Callers 2

refreshAllEntriesFunction · 0.85

Calls 3

readAnchorsForSelectorFunction · 0.85
areAnchorListsEqualFunction · 0.85
notifySubscribersFunction · 0.85

Tested by

no test coverage detected