MCPcopy Create free account
hub / github.com/thetarnav/solid-devtools / getOwnerType

Function getOwnerType

packages/debugger/src/main/utils.ts:71–102  ·  view source on GitHub ↗
(o: Solid.Owner)

Source from the content-addressed store, hash-verified

69const SOLID_REFRESH_PREFIX = '[solid-refresh]'
70
71export const getOwnerType = (o: Solid.Owner): NodeType => {
72 if (typeof o.sdtType !== 'undefined') return o.sdtType
73 if (!isSolidComputation(o)) {
74 if ('sources' in o) return NodeType.CatchError
75 return NodeType.Root
76 }
77 if (isSolidComponent(o)) return NodeType.Component
78 // memo
79 if ('comparator' in o) {
80 if (
81 // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
82 (o.owner as {component?: Function} | null)?.component?.name.startsWith(
83 SOLID_REFRESH_PREFIX,
84 )
85 ) {
86 return NodeType.Refresh
87 }
88 return NodeType.Memo
89 }
90 // Effect
91 if (!o.pure) {
92 if (o.user === true) return NodeType.Effect
93 /*
94 after solid 1.8 context is being copied to children owners
95 so need to check if the reference is the same
96 */
97 if (o.context !== null && (!o.owner || o.owner.context !== o.context))
98 return NodeType.Context
99 return NodeType.Render
100 }
101 return NodeType.Computation
102}
103
104export function getNode(
105 o: Solid.SourceMapValue | Solid.Signal | Solid.Owner | Solid.Store,

Callers 8

visitSourcesFunction · 0.90
visitObserversFunction · 0.90
debugOwnerComputationsFunction · 0.90
debugPropsFunction · 0.90
logOwnersDiffFunction · 0.90
logOwnerListFunction · 0.90
getNodeTypeFunction · 0.85
markOwnerTypeFunction · 0.85

Calls 2

isSolidComputationFunction · 0.85
isSolidComponentFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…