Skip to content

Commit

Permalink
fix(devtools): logs subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
artalar committed Jan 24, 2025
1 parent 01029e3 commit 78eefeb
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 16 deletions.
33 changes: 19 additions & 14 deletions packages/devtools/src/Graph/reatomFilters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,22 +113,27 @@ const FilterView = ({ filter, remove }: { filter: Filter; remove?: Fn<[Ctx]> })
&:hover {
border: 4px solid #151134;
}
&:before {
position: absolute;
content: '';
width: 100%;
height: 100%;
background: ${icons.paintIconBucket};
background-size: 80%;
background-repeat: no-repeat;
background-position: center;
z-index: 1;
pointer-events: none;
}
& input {
opacity: 0;
}
&[data-highlight] {
border: 4px double #151134;
}
&:not([data-highlight]) {
input {
opacity: 0;
}
&:before {
position: absolute;
content: '';
width: 100%;
height: 100%;
background: ${icons.paintIconBucket};
background-size: 80%;
background-repeat: no-repeat;
background-position: center;
& input {
opacity: 1;
}
}
`}
Expand Down
4 changes: 3 additions & 1 deletion packages/devtools/src/ObservableHQ.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,18 @@ const EditForm = ({

export const ObservableHQ: FC<{
snapshot: Atom | {}
subscribe?: boolean
update?: (newState: any) => any
name?: string
patch?: AtomCache
}> = ({
snapshot,
subscribe = false,
update,
patch,
name = isAtom(snapshot) ? `${snapshot.__reatom.name}.ObservableHQ` : __count('ObservableHQ'),
}) => {
const state: AtomMut = isAtom(snapshot)
const state: AtomMut = subscribe
? atom(null, `${name}.state`).pipe(withComputed((ctx) => ctx.spy(snapshot as Atom)))
: atom(snapshot, `${name}.state`)

Expand Down
2 changes: 1 addition & 1 deletion packages/devtools/src/States.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export const States = ({
<div ref={subscribe}>
{reloadEl}
{logEl}
<ObservableHQ snapshot={snapshot} />
<ObservableHQ snapshot={snapshot} subscribe />
</div>
),
)}
Expand Down

0 comments on commit 78eefeb

Please sign in to comment.