Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(notebooks): add pinned-only filter to profile properties node (#72417)

Arthur Moreira de Deusb16e07b1674b
diff --git a/frontend/src/scenes/notebooks/Nodes/NotebookNodeGroupProperties.tsx b/frontend/src/scenes/notebooks/Nodes/NotebookNodeGroupProperties.tsx
index 137832639030..51fd2de3f89d 100644
--- a/frontend/src/scenes/notebooks/Nodes/NotebookNodeGroupProperties.tsx
+++ b/frontend/src/scenes/notebooks/Nodes/NotebookNodeGroupProperties.tsx
@@ -32,6 +32,7 @@ const Component = (): JSX.Element | null => {
return (
<Properties
+ key={`${groupData.group_type_index}-${groupData.group_key}`}
properties={groupData.group_properties || {}}
pinnedProperties={pinnedGroupProperties}
onPin={pinGroupProperty}
diff --git a/frontend/src/scenes/notebooks/Nodes/NotebookNodePersonProperties.tsx b/frontend/src/scenes/notebooks/Nodes/NotebookNodePersonProperties.tsx
index 04f20350ded2..caec3836adc8 100644
--- a/frontend/src/scenes/notebooks/Nodes/NotebookNodePersonProperties.tsx
+++ b/frontend/src/scenes/notebooks/Nodes/NotebookNodePersonProperties.tsx
@@ -35,6 +35,7 @@ const Component = ({ attributes }: NotebookNodeProps<NotebookNodePersonPropertie
return (
<Properties
+ key={id}
properties={person.properties || {}}
pinnedProperties={pinnedPersonProperties}
onPin={pinPersonProperty}
diff --git a/frontend/src/scenes/notebooks/Nodes/components/Properties.tsx b/frontend/src/scenes/notebooks/Nodes/components/Properties.tsx
index c95c3c6e5fb2..a92b82fa42ca 100644
--- a/frontend/src/scenes/notebooks/Nodes/components/Properties.tsx
+++ b/frontend/src/scenes/notebooks/Nodes/components/Properties.tsx
@@ -28,6 +28,7 @@ export function Properties({
type,
}: PropertiesProps): JSX.Element | null {
const [searchTerm, setSearchTerm] = useState('')
+ const [showPinnedOnly, setShowPinnedOnly] = useState(true)
const { hideNullValues } = useValues(userPreferencesLogic)
const { setHideNullValues } = useActions(userPreferencesLogic)
@@ -48,10 +49,14 @@ export function Properties({
entries = entries.filter(([, value]) => value !== null)
}
+ if (showPinnedOnly) {
+ entries = entries.filter(([key]) => pinnedProperties.includes(key))
+ }
+
entries = sortProperties(entries, pinnedProperties)
return Object.fromEntries(entries)
- }, [properties, searchTerm, hideNullValues, pinnedProperties])
+ }, [properties, searchTerm, hideNullValues, showPinnedOnly, pinnedProperties])
const numProperties = Object.keys(filteredProperties).length
const totalProperties = Object.keys(properties).length
@@ -73,13 +78,16 @@ export function Properties({
label="Show null"
size="small"
/>
+ <LemonCheckbox checked={showPinnedOnly} onChange={setShowPinnedOnly} label="Pinned only" size="small" />
</div>
{numProperties === 0 ? (
<div className="text-muted text-center py-2 text-xs">
- {searchTerm || hideNullValues
- ? `No properties match your filters (${totalProperties} total)`
- : 'No properties'}
+ {showPinnedOnly && !searchTerm && !hideNullValues
+ ? `No pinned properties (${totalProperties} total)`
+ : searchTerm || hideNullValues || showPinnedOnly
+ ? `No properties match your filters (${totalProperties} total)`
+ : 'No properties'}
</div>
) : (
<div>
@@ -111,7 +119,7 @@ export function Properties({
</div>
)}
- {(searchTerm || hideNullValues) && numProperties > 0 && (
+ {(searchTerm || hideNullValues || showPinnedOnly) && numProperties > 0 && (
<div className="text-muted text-xs mt-1">
Showing {numProperties} of {totalProperties} properties
</div>