: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(taxonomic-filter): reduce typing work and debounce searches (#98786)
Matt Pua1eb8c2147a9a
diff --git a/docs/internal/taxonomic-filter-search.md b/docs/internal/taxonomic-filter-search.mdindex c1287ec3468b..433d011d4d25 100644--- a/docs/internal/taxonomic-filter-search.md+++ b/docs/internal/taxonomic-filter-search.md@@ -10,6 +10,12 @@ The expansion count must not delay the scoped results or keep the aggregate reveThe legacy implementation separates these requests in `infiniteListLogic.ts`; the rebuilt implementation uses independent resources in `hooks/useGroupList.ts`. Keep this behavior consistent across both implementations.+## Typing and rendering++The legacy picker debounces API searches for 500 ms after the last keystroke, including while the initial response is loading.+The initial empty-query load bypasses this wait.+Local filtering and rendering still update on each keystroke.+## Event list paginationThe event definitions API counts matching rows separately and applies `LIMIT` and `OFFSET` in PostgreSQL. The count describes all matches, including matches outside the requested page. Explicit ordering uses the project-unique event name as a final tie-breaker so equal timestamps do not cause skipped or repeated results between pages.diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 1fc9a2253e89..afb66f9ae203 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -2845,81 +2845,85 @@ snapshots:filters-propertygroupfilters-data-exploration-andorfilterselect--default--light:hash: v1.k794b7964.878d5718b31de7391125577d89e8f5a2aff382328cc2ecbb92ccf7a11153a477.HrJBJwrpwOBffqHfDG_XUostPZKCiuts0wUpu35Ikjgfilters-taxonomic-filter--actions--dark:- hash: v1.k794b7964.b7c757ee23be748f5575fd797100909237d9f8a51380c238e28f8be92dfe9675.sQGQQY7si0_EphicqOD-3pvgEuWhah3SZA4e6TVTnIw+ hash: v1.k794b7964.b147cec852bb8d234f70b5c7e68bd8123b8093eaf8ea6371123c1d4479fbc421.tCzSDaXz7IYSSW3p7RKBDv1tmqpzOnP3ckwAnCHHk-Efilters-taxonomic-filter--actions--light:- hash: v1.k794b7964.4913bcfd390eb413407696520affbe647ae1bec1a33036b6d17ba7ea844f1cf0.Hf-hM-HkNe5FLsYIb8g4D6dmJSNPz7SdXdv-lMUBfWU+ hash: v1.k794b7964.e9ad4f3da4d49618e27ce94d2bbb96c36b22d721ab6fbdaf9a109d1762b22947.ozbZjGXyW-4REjQPYdFepAJP9Fum0iBhYt0J6X5Arb0filters-taxonomic-filter--autocapture-context-promotes-elements--dark:- hash: v1.k794b7964.dca62c799f03d32fa5e78dc93686f457d9206404acdec8df68633ccb7b7b9a4b.9zs6tQlqs3ma52aFuOgEtbkTfDNdJNJMcxy7jEym0xo+ hash: v1.k794b7964.13312abe2665597be3e3a779494b2e51f5f74c89ce7eac95653b26f16acb86c6.KOMCM99FtN43dDsCRfwN2ZEw5tkk01KubylmO-Ov2Hgfilters-taxonomic-filter--autocapture-context-promotes-elements--light:- hash: v1.k794b7964.4dd4d19943fd93546b0cbc9d30010f5a0f2d37b452d9d25fab7b893cd31d964d.f9sQMfm-G3rEf1-9ndjq06-fU2Wad76DgMCtsM9cU8c+ hash: v1.k794b7964.ca7b22fedb53fcb2ea5f7e3702d7e5a368711827e775c3ecd8131a2628cd9b9d.2RoB92_wh_113k57g2EcUuvn9-9SukgL_eAnoHV0hHk+ filters-taxonomic-filter--dashboard-property-search--dark:+ hash: v1.k794b7964.c824be157968e0ef1b8dc82810f4a06dfff364af71722c53823f1d95d4542f7f.D-ZfI3CwGqAa9tdEaUF_psLO6gqWhGZTQnN6Y9i8GRY+ filters-taxonomic-filter--dashboard-property-search--light:+ hash: v1.k794b7964.d6743ee11d1ef80cc0fb6ceaf465684d2fe455ff2e1c4caa423b255dd9ca6dc3.O0RT-HV6tHeocwL0QPZGUceekoc42axbz0eD_buMRtEfilters-taxonomic-filter--empty-events-with-stale-toggle--dark:- hash: v1.k794b7964.08228076e08730064be861331cc3cf4f98078681b87370be10fa6794f3597a9a.DQF2mmye8IbGqFPiD7rx_qOjbi5mIQeRnvJodT9IIYM+ hash: v1.k794b7964.76de2509a270a603ac3c1042f75696924394f9fb351a4e7941e2c3b5e131ffc3.swWiwyJN2wEnpQKXFgoJL7eAyKNskSLsjKxC6jorN2Yfilters-taxonomic-filter--empty-events-with-stale-toggle--light:- hash: v1.k794b7964.b2a3bb8b2902d3d4ae0eb4b47d0131f25dcc6303b41c0303e424a7295139f0f6.jvo9BHi6hN63Rb_NS0EGojbpyfY53s8XfZduhDSqKo8+ hash: v1.k794b7964.9b4ef58d5d3035111d2c92acca7177cb01478a749820f54f8912fc272e968b37._qqVGysKdxr5NnW69wiuWjM63ab9pH6wRWyWdXVyQEUfilters-taxonomic-filter--events-free--dark:- hash: v1.k794b7964.422ddb7aef488b7df5fb0a27715994aed79448f280b62f4e786e08f755c88b3c.QRr2tV6xVwM-BwtU7yaivV0kH9MUWMZYRUvBMmsi1k4+ hash: v1.k794b7964.4728d9998e7463c1600fb8a835f53e94eb17e822ff2957d1fe1e435187839e00.6cDum7LVx0zYoaAnz_I1fEm7xxUhYu3PKUxAEObYp0Qfilters-taxonomic-filter--events-free--light:- hash: v1.k794b7964.81a78bc8ee376be4d5515ddcab000082de15195a6ea1e700546a2346d4cb17f3.oHD_2YCYCi-U-9O2TbEzBoTQAA4-yI_0UWlQEraMHtM+ hash: v1.k794b7964.4bc7c503eb7c60a0828cea65478bc49899374adea1216c04adf775c0ffb5cfa6.Q9xVXAq5AaB4BZvLViH8eMdpPfbkhXoKuH_LnP3hCfQfilters-taxonomic-filter--events-premium--dark:- hash: v1.k794b7964.422ddb7aef488b7df5fb0a27715994aed79448f280b62f4e786e08f755c88b3c.kny9iJ5G5fwjTNqF1xKveHzAT06hjte-CATByxBVFaM+ hash: v1.k794b7964.4728d9998e7463c1600fb8a835f53e94eb17e822ff2957d1fe1e435187839e00.Az6vx9a8qf5ryFiBqPbsj0zwC1m4awc64ZSyWavbs3gfilters-taxonomic-filter--events-premium--light:- hash: v1.k794b7964.81a78bc8ee376be4d5515ddcab000082de15195a6ea1e700546a2346d4cb17f3.BZBvpIZWaczTKJuEBUyigcG45af_A0jgpe10HbXQ9rQ+ hash: v1.k794b7964.4bc7c503eb7c60a0828cea65478bc49899374adea1216c04adf775c0ffb5cfa6.gyk-SHcghSSVxdwCrkcP_uRmbVEtEWm5bKr2AQ-gbNwfilters-taxonomic-filter--failed-fetch-offers-retry--dark:- hash: v1.k794b7964.764133a4cc28a4b01372322367dda592dc521ab838af7d49c7dd7176e2bf2794.8jZ9b-QhEuLkgMpJKPskNsfK2JtsEWnzOmip4D-ZjaQ+ hash: v1.k794b7964.7affde427862d7de5b1cab03a672aed48b87ed3006846a24470acf64ecd0624a.Q2RfgFsnhGSxMIrTad4pK0_EL1haMF7LVMNS44-ouT0filters-taxonomic-filter--failed-fetch-offers-retry--light:- hash: v1.k794b7964.d49969fc6b2b1348d9218aeec15af57043f266524a456e3a94797d5fc8c6be29.0WQyr1HImGzP1uQ1WfJFtlzkRcsL62im58J-3OQBu9k+ hash: v1.k794b7964.36f5fbef198864bb67c573011d12deaf10c758d4559c00091e78611179b578a8.7h32K41k_GmUQ_gVHHJTLNQBlaVxEsoemhDkVbd30iQfilters-taxonomic-filter--mcp-tool-call-context-leads-with-mcp-properties--dark:- hash: v1.k794b7964.516e000f2b252b50ff5808b2b21956dc5c1b943663b4cf70a23e556c47370aea.4-eVYaADVRoXPXSs_7nXO9tp3PhK81n-BxMpHmfhIuU+ hash: v1.k794b7964.10cc6a0dfeff4c0fecc10418d1bd6e90cc2686fd6a167cea912e3570fe13590a._l3WLEzX0NIrgvCBNhgnN3CZNXLAGd-bQemIa1S-DAMfilters-taxonomic-filter--mcp-tool-call-context-leads-with-mcp-properties--light:- hash: v1.k794b7964.ee153b5bf9231128a4f15378a7ef84e95919d2c388841abf2cc3f5c6f3e441b1.5QKuhR77wYA4tG94TQSH9x07rDtKQqZBzTBJLWagVBM+ hash: v1.k794b7964.36dbfe3bdf83c5e7f5ca5dd73edce02e2332e6963a6cec1b2fc340a4fc43d3e9.upFO8FMMmioJV0MXg-D5zki4cr14Q1lq46ElK8UdwZofilters-taxonomic-filter--numerical-properties--dark:- hash: v1.k794b7964.211cf5cd352dfb7271a57636456aa1941fc4fee60d3b9cb90fd5e085590c15df.n-ZDoAvfpbf_TK1KAI71t8q8LlsAC7SFPpUVDGTmfyA+ hash: v1.k794b7964.f1b9ceffefc1db431c69b114eb7bbf01fcf44fc9137a265bad916ed42221852c.FK72gkH7MwatSmdb2S-aFeRobalvNAyXGpSHncGRPnMfilters-taxonomic-filter--numerical-properties--light:- hash: v1.k794b7964.eeb595aa423f9104a03146d58f306ebd252f3bdda868b8655a5761018ab7427c.j2JfKgLjpJ7o0RyENwpHLY4OngOa0-6sLl1L0PsLM1Y+ hash: v1.k794b7964.ba3a2e9972895ac0a858c7195915cc32888fe3099f84f3c6be96e4b103e49abb.AqNbJAtz6T4T9JBqUTaufE3DQFsvYsBMYHMWaKryVpgfilters-taxonomic-filter--promoted-groups-are-reordered--dark:- hash: v1.k794b7964.f81893f96f2fdf6f34e3847b07d488fbd9581db1ff4a9fcd7733d9640db3ca18.aZFpQokd32LdMEyxYS9VLnH2BxzZn_GoRKWm6pc5YP4+ hash: v1.k794b7964.6c154df0fe8a33d64cecdcbe9c80c41f75b44955fcfe8d8cb1b7e976e63f52b1.a3rQeqa6kFtRaryK0VWQEV3kstMPDV26z95D0g9Nzk4filters-taxonomic-filter--promoted-groups-are-reordered--light:- hash: v1.k794b7964.e34402933bb4d12683355aba98f2b5b7352801360f91faa7d7074689d6df245a.mb1YqD773nn7QwBDTu3bJ3QXn5z0jsibsLI6U9ey2tU+ hash: v1.k794b7964.72c3cdabb378b0bab4db9351c673157e381d52a6e94778371669773633a62a8f.viAye9V24wtTD6Q4njvN_VmFnuiDRAqv_g7jNCuHEpAfilters-taxonomic-filter--properties--dark:- hash: v1.k794b7964.aa34b04cf14ce8e95422fcf1c2dd76ac83b04eac3e6c6d5326dbce7eee4d0f11.XXsKHQ9DntH3SiWm0zeEz4W6r0Uj9VxqAtxK1LRC4Uo+ hash: v1.k794b7964.7f10cc4d299efb2748a201883f681f8f463f0061d3886b659e89d34829116360.VeADZfhbb9MjF6HG4YSYqoHrt4bQSJN83OhaJNsU_mUfilters-taxonomic-filter--properties--light:- hash: v1.k794b7964.f0a0b723b949646469217e024a4e6e6ae850a8e1aab2ecb9fdc8aa01c91fe37b.zvxvcSMTj0228nQgbDWGPKnQnEnZriSgYqSXHsS4uow+ hash: v1.k794b7964.a229571ad3b105ff6350ff66d6584a5bff7ab819094807911df1b9d285c1a3b9.BX0vgClKIjK4LgjSkYKXQ7ovpHxl-3E1R3FLtGSEJ5cfilters-taxonomic-filter--renamed-series-selected--dark:- hash: v1.k794b7964.d171753ea28fab36fdd7b333b71c459316a3d56b8510428f76f10dd3766db2ee.rJJHqtMhYIM1E6L9WnzpgFcmHulFoAF-2zoFKckHPr4+ hash: v1.k794b7964.7503afa148b4575964fcee6837b0dbfb532f20b5377421b9cc913c7732f0b132.FyuVsOtCZUJnnsiu5PPDWGz-8PnRIIXWZvjpfVn4SBsfilters-taxonomic-filter--renamed-series-selected--light:- hash: v1.k794b7964.79fddbe04eea9e536de410d844966e2c71959d41a3da1c6b3116f9f1cce43b68.EomfMMVVg1dDNboHFqlV_y2_SqBU-T7r00gaZMw41iA+ hash: v1.k794b7964.265574dccf819679ece5d89bc7578776d89986efe77372678c7105c1c0b7ba76.ayar1_PHKhSooqRgpBghGwD_0i_nUQ11CSMzG5hy-VIfilters-taxonomic-filter--renamed-series-selected-pill--dark:- hash: v1.k794b7964.f681a891cf1a49fe34253ae53f3bbe0820335ba19be87f8f2d98d81640f44383.8woP71XaCibqOkMeWDnx802gdgtvvEnOeC8ZxOYjmc8+ hash: v1.k794b7964.eaef81d99ef62f0177d1c2ced630859e192db2e35931e339050b9e016135ffdd.I-1JCC4Mjbm7HoyRWtKjTxrjCCZw7pF9sQQco-4inf8filters-taxonomic-filter--renamed-series-selected-pill--light:- hash: v1.k794b7964.f370ef52a9edbe522c15b7ed190b68f42658405bd6bac25931fee7e5eb10c5f0.GlfhRst66pYAYzSgrAcSA1b8IbwtD_PEpJMa-XtVWNA+ hash: v1.k794b7964.be8eb8d6bdb15d011e6e83767b2e479889d1bfddd5845c22e94b28a0536edda5.Gn81WhxJ1Nyqg-Y96fbwf3rPb5gNR8mGPOQ9ZbKsftgfilters-taxonomic-filter--six-groups-default-layout--dark:- hash: v1.k794b7964.6720b50c7ba8f3918a8c142a86467b7a910a5c6f0d88d49ca8042afbf628877e.I5xU7-YqIfvND-ac2n3lc_kN5TEraGL5oLW-VNPkmcI+ hash: v1.k794b7964.3ff86f47ef2d3dba1fee33ff0b272957a3fb9be9c58fe15916a26d40648f8da2.nepSeMiVZl-HrJhjENRmfWJJJjl4U1tl2MJdRAZdNzMfilters-taxonomic-filter--six-groups-default-layout--light:- hash: v1.k794b7964.2b35cab321e44ea92319f32ba472e98060a16f33a9f78add392558f355fa65f8.WVEXHn1UNrYtkOhxbuTA_AXUp8EZZMeUuxb9nSgBLxg+ hash: v1.k794b7964.003b83d06952bfc711fe95e8abd69639de0f985d684cfa0fc25f4d2ef2b2c04a.wFXjZUyCqKbHsU7G_fQWm2xT3hoVdRGjynqvYZzFSZIfilters-taxonomic-filter--slow-expansion-count--dark:- hash: v1.k794b7964.f8bab5e9a170682fbaad198c797d11f9bf4b8ad0c963d15284e275a8288c3103.NBrTJPSNHo80dbma7MGbu1AXsJpkb03Mx-MwAk5DLzU+ hash: v1.k794b7964.55ab882bfbf3409d3c1fc7b6bc1e789d0dc45df6be476d064e3e31846d0198a7.O9i884MaNqkYvB79uREi2Rokijv0XzzCq608uUQc6a4filters-taxonomic-filter--slow-expansion-count--light:- hash: v1.k794b7964.949427396f7f328e1312778ebc41c332f662f9b04a3eb767fb626c309f59fd3c.dFGW6CBI5dxi8Lrebe7-Y-z29RGsX7NnmRc16RyJJIM+ hash: v1.k794b7964.c4dc4ba4ef70489c68bbe39604f9c2b7a151b966c7024d8d731524621b7ea841.sViaRKl9qfetOS3eSjqiGA9hBiQAvn8zNn9dOuKUL-Qfilters-taxonomic-filter--suggested-filters-five-recents-with-truncation--dark:- hash: v1.k794b7964.25d42d72439b6a31aa14c91933e091cd010281067e48355338727eb6e6c169e5.n2FA6RwmuDEZEQDnL0NEbHSDLT1m1GKIyItwzXP2tDA+ hash: v1.k794b7964.25c5a602de850aa30dab99cdcdd94e05228979717d8642e1e167ff9094998a61.39lfsQXVq0JdwFukLKAgSxXGi1-YYpsSCA2AbYmZrb4filters-taxonomic-filter--suggested-filters-five-recents-with-truncation--light:- hash: v1.k794b7964.aecaa0e01c14391c22623379d0a08b7cf0728ccba0adb8c87f732f14d52d09f0.M-lJXUmzM0bz0OZkZW5_O9NgdEfgw4TMHudVv77KyMk+ hash: v1.k794b7964.6991b91cb5fe413bbaa3f3c474ca93a185dac031ac9bd67fb5feb9fe52ff6076.I9lPDR1Dig43x6KwtNF2cZMPg5b1OKRnMDuK7IsnD24filters-taxonomic-filter--suggested-filters-four-recents--dark:- hash: v1.k794b7964.5e1aa023a7a17a0bbafb44dd957d51d3b5c3d97d04ab48c1a4ef04eb6d36f8d3.mmCdqWmigEtO9v0v18dyv0SsPVaqNWXw5lcZLy_CNKE+ hash: v1.k794b7964.f41d252e1354dd4737fcc4890b36a75512c3250b75e5a2ece14ed759e995fd63.Dn9PdpJKIB1ZBQ7rE1wm3dnLfWzROZLwYhuh_kPu-jEfilters-taxonomic-filter--suggested-filters-four-recents--light:- hash: v1.k794b7964.a32319e0634a4969e23e645b1cf8627aacd24e3e9989989630ae39260af797cd.psBs1LrQDMcTtetK52q9ifxGlzQQPVSxT0SD1zNa3vE+ hash: v1.k794b7964.034325fb40592dcc4f98ca304a7889506162063e5247855ce5125c2447c2cbc3.Y68te_XBpKoJJaYU-SC4NXlSiJfLCzMFvu5sXpPEY-sfilters-taxonomic-filter--suggested-filters-no-recents--dark:- hash: v1.k794b7964.c5f0a7c145a2233492f0b80ecf1957269bafb0c4f8b019ad14211b86cce0ebd6.nW_8jQnfZqBcXl0r2CZZeJJGBxglwHrHcCEZls8sfaY+ hash: v1.k794b7964.c4a4c0ecc19f72c726367085f912e7ebd8ba9b7615a8a5c61f156fb31a1f2784.W6PaoiG2KnuNbVco_uiAQyVqi45rwV2fK4WBQZ8ztjQfilters-taxonomic-filter--suggested-filters-no-recents--light:- hash: v1.k794b7964.a36729c9f19a915cc101aea813e1ef57fc3bbd852da1d067fdf8dc04a1002a04.BsH63rmnZdbgGVXDp8_QDbR_bSeJmHuCmyoiGqawuzA+ hash: v1.k794b7964.a8446e83493a18ac462e5c7a1bda7db842e3b0e39f22125cfadd7b8cc61930a8.VRodVeEYNl9jrtzcmLWePm0tnIHaz8Ta9hEUehuC2hcfilters-taxonomic-filter--suggested-filters-one-recent--dark:- hash: v1.k794b7964.37b810c260fdddede2201028ccb2c0bfea89d3109743e9382665319bd33c8551.OzSahZmx-3PZm1qeQVpikIpMHyUSbiHdKFFrK826hyU+ hash: v1.k794b7964.cac8dad592810a3cac21074959a40e82a7c95aa65d720c923de234e20bbae6fc.DPlP3uLjgPiXJbaMow_ktoMovWWa4bMnRf3BlAeekCkfilters-taxonomic-filter--suggested-filters-one-recent--light:- hash: v1.k794b7964.2db83c5d288e1c302a22f9e494a7492e3030a6fbe4602883597b5ac972786ece.F2N74fh7e4s8POm9LYFJPqbdq41fYgqArkJL-sUT3BA+ hash: v1.k794b7964.2e2cb135cba1b584258e28105d308b2d3bfd405f39884bd80a6effa1f6d9667c.ozDvOSPG6-ovzLmvHX53EMwxiZalo5Y_sl33twu7FN0filters-taxonomic-filter--three-groups-default-layout--dark:- hash: v1.k794b7964.d7e9d0f2daf79af28b9cf169079cfe22824acfba001bc88260ba731807c5776b.JlVS-SvJF5DPB9KXQNXp9jRe8ZZREt9AF9eB681ynqM+ hash: v1.k794b7964.33e6bc12018b8fa898795c367382f10b34f3254217c943ed6e3a4ea115b11c5b.N8veqMWb7ahuE2b0FAmFc2R8lCHuFq3VcqevUTB7Ykgfilters-taxonomic-filter--three-groups-default-layout--light:- hash: v1.k794b7964.b0d92a623d942f1378fd21f5d854d4e7764713ad759b5a74201e6d9806d46b48._przGLIsFcasVn8JIVDPIVC1JAnnqtA7Yn2v18iUbi0+ hash: v1.k794b7964.b0064791a0c92e466cc4407b015fd3606a806c09d0d61b914682e2dbb687d572.QiaBRTp7nIEJai8kC0F6vl3i-wJDVuCzXw7J8sVx8KMfilters-taxonomic-filter-menu-rebuild--data-warehouse-config--dark:hash: v1.k794b7964.695594eab6753acf560cbd54ecd1fa59157d0844e11c1ace7fe5e0637d60a570.84QX-AsU_pJxzLcbc1edVoTr4rn-EnEY25SbyuXe7Ysfilters-taxonomic-filter-menu-rebuild--data-warehouse-config--light:diff --git a/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.stories.tsx b/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.stories.tsxindex 9642e8b2c39e..308ba47f553b 100644--- a/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.stories.tsx+++ b/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.stories.tsx@@ -41,6 +41,32 @@ const meta: Meta<TaxonomicFilterProps> = {type Story = StoryObj<TaxonomicFilterProps>export default meta+export const DashboardPropertySearch: Story = {+ args: {+ taxonomicFilterLogicKey: 'dashboard-property-search',+ taxonomicGroupTypes: [+ TaxonomicFilterGroupType.EventProperties,+ TaxonomicFilterGroupType.PersonProperties,+ TaxonomicFilterGroupType.EventFeatureFlags,+ TaxonomicFilterGroupType.EventMetadata,+ TaxonomicFilterGroupType.PageviewUrls,+ TaxonomicFilterGroupType.Screens,+ TaxonomicFilterGroupType.EmailAddresses,+ TaxonomicFilterGroupType.Cohorts,+ TaxonomicFilterGroupType.Elements,+ TaxonomicFilterGroupType.SessionProperties,+ TaxonomicFilterGroupType.HogQLExpression,+ TaxonomicFilterGroupType.DataWarehousePersonProperties,+ ],+ enableKeywordShortcuts: true,+ collapseUrlsToContainsRow: true,+ },+ parameters: {+ featureFlags: { [FEATURE_FLAGS.TAXONOMIC_FILTER_CATEGORY_DROPDOWN]: 'pill' },+ testOptions: { waitForSelector: '.taxonomic-infinite-list' },+ },+}+function EventsStoryRender(args: TaxonomicFilterProps): JSX.Element {useMountedLogic(actionsModel)diff --git a/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.test.tsx b/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.test.tsxindex 627712d2c4fa..e51b65e64339 100644--- a/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.test.tsx+++ b/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.test.tsx@@ -1,8 +1,8 @@import '@testing-library/jest-dom'-import { act, cleanup, render, screen, waitFor } from '@testing-library/react'+import { act, cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'import userEvent from '@testing-library/user-event'-import { Provider } from 'kea'+import { Provider, getContext } from 'kea'import posthog from 'posthog-js'import { FEATURE_FLAGS } from 'lib/constants'@@ -32,8 +32,15 @@ jest.mock('~/queries/query', () => ({}))jest.mock('lib/components/AutoSizer', () => ({- AutoSizer: ({ renderProp }: { renderProp: (size: { height: number; width: number }) => React.ReactNode }) =>- renderProp({ height: 400, width: 400 }),+ AutoSizer: ({ renderProp }: { renderProp: (size: { height: number; width: number }) => React.ReactNode }) => {+ const { useState, useRef, useLayoutEffect } = jest.requireActual<typeof import('react')>('react')+ const [visible, setVisible] = useState(false)+ const ref = useRef<HTMLDivElement>(null)+ useLayoutEffect(() => {+ setVisible(!!ref.current && !ref.current.closest('.hidden'))+ })+ return <div ref={ref}>{renderProp({ height: visible ? 400 : 0, width: visible ? 400 : 0 })}</div>+ },}))describe('TaxonomicFilter', () => {@@ -105,6 +112,83 @@ describe('TaxonomicFilter', () => {}}+ it('keeps dashboard search to one visible list and a bounded number of store updates', async () => {+ const propertySearches: string[] = []+ useMocks({+ get: {+ '/api/projects/:team/property_definitions': (info) => {+ const search = new URL(info.request.url).searchParams.get('search')+ if (search) {+ propertySearches.push(search)+ }+ return mockGetPropertyDefinitions(info)+ },+ },+ })+ featureFlagLogic.mount()+ featureFlagLogic.actions.setFeatureFlags([FEATURE_FLAGS.TAXONOMIC_FILTER_CATEGORY_DROPDOWN], {+ [FEATURE_FLAGS.TAXONOMIC_FILTER_CATEGORY_DROPDOWN]: 'pill',+ })+ const { container } = renderFilter({+ taxonomicGroupTypes: [+ TaxonomicFilterGroupType.EventProperties,+ TaxonomicFilterGroupType.PersonProperties,+ TaxonomicFilterGroupType.EventFeatureFlags,+ TaxonomicFilterGroupType.EventMetadata,+ TaxonomicFilterGroupType.PageviewUrls,+ TaxonomicFilterGroupType.Screens,+ TaxonomicFilterGroupType.EmailAddresses,+ TaxonomicFilterGroupType.Cohorts,+ TaxonomicFilterGroupType.Elements,+ TaxonomicFilterGroupType.SessionProperties,+ TaxonomicFilterGroupType.HogQLExpression,+ TaxonomicFilterGroupType.DataWarehousePersonProperties,+ ],+ })+ await screen.findByTestId('taxonomic-category-dropdown-trigger-pill')+ expect(container.querySelectorAll(':not(.hidden) > .taxonomic-infinite-list')).toHaveLength(1)+ let dispatches = 0+ const unsubscribe = getContext().store.subscribe(() => dispatches++)+ const searchField = screen.getByTestId('taxonomic-filter-searchfield')+ jest.useFakeTimers()+ try {+ for (const query of ['p', 'pr', 'pro', 'prop', 'prop1']) {+ dispatches = 0+ fireEvent.change(searchField, { target: { value: query } })+ expect(searchField).toHaveValue(query)+ expect(dispatches).toBeLessThan(5)+ await act(async () => {+ await jest.advanceTimersByTimeAsync(100)+ })+ }+ expect(propertySearches).toEqual([])+ await act(async () => {+ await jest.advanceTimersByTimeAsync(399)+ })+ expect(propertySearches).toEqual([])+ await act(async () => {+ await jest.advanceTimersByTimeAsync(1)+ })+ expect(propertySearches).toEqual(['prop1', 'prop1', 'prop1'])+ } finally {+ unsubscribe()+ jest.useRealTimers()+ }+ await screen.findAllByText('prop1')+ expect(container.querySelectorAll(':not(.hidden) > .taxonomic-infinite-list')).toHaveLength(1)++ await userEvent.click(screen.getByTestId('taxonomic-category-dropdown-trigger-pill'))+ await userEvent.click(screen.getByTestId('taxonomic-category-dropdown-item-person_properties'))+ await screen.findByTestId('prop-filter-person_properties-0')+ expect(container.querySelectorAll(':not(.hidden) > .taxonomic-infinite-list')).toHaveLength(1)+ await userEvent.click(screen.getByTestId('prop-filter-person_properties-0'))+ expect(onChangeMock).toHaveBeenCalledWith(+ expect.objectContaining({ type: TaxonomicFilterGroupType.PersonProperties }),+ 'prop1',+ expect.objectContaining({ name: 'prop1' })+ )+ })+// Search interactions pay taxonomicFilterLogic's real 500ms breakpoint (plus stacked// 100ms ones), which is what pushed these tests over CI's per-test timeout. Fake timers// skip that wait; real timers resume immediately after so the resulting MSW round trip@@ -318,8 +402,6 @@ describe('TaxonomicFilter', () => {})describe('no results - switch to all', () => {- // Every group type renders its list (active one visible, the rest hidden via CSS), so the- // empty-state button can appear in several hidden tabs at once. Scope queries to the visible tab.const inVisibleTab = (elements: HTMLElement[]): HTMLElement | undefined =>elements.find((el) => !el.closest('.hidden'))@@ -1517,9 +1599,8 @@ describe('TaxonomicFilter', () => {hideSearchInput: true,})- await waitFor(() => {- expect(screen.getByTestId('prop-filter-events-0')).toBeInTheDocument()- })+ await screen.findAllByText('All')+ expect(screen.queryByTestId('prop-filter-events-0')).not.toBeInTheDocument()expect(screen.queryByText('Categories')).not.toBeInTheDocument()expect(screen.queryByTestId(/taxonomic-category-dropdown-trigger-/)).not.toBeInTheDocument()@@ -1581,16 +1662,15 @@ describe('TaxonomicFilter', () => {taxonomicGroupTypes: [TaxonomicFilterGroupType.Events, TaxonomicFilterGroupType.Actions],})- await waitFor(() => {- expect(screen.getByTestId('prop-filter-events-0')).toBeInTheDocument()- })+ await screen.findByTestId('taxonomic-category-dropdown-trigger-pill')+ expect(screen.queryByTestId('prop-filter-events-0')).not.toBeInTheDocument()await userEvent.click(screen.getByTestId('taxonomic-category-dropdown-trigger-pill'))await userEvent.click(await screen.findByTestId('taxonomic-category-dropdown-item-actions'))await waitFor(() => {- expect(screen.getByTestId('prop-filter-actions-0')).toBeInTheDocument()+ expect(screen.getByTestId('prop-filter-actions-0').closest('.hidden')).toBeNull()})})@@ -1600,9 +1680,7 @@ describe('TaxonomicFilter', () => {taxonomicGroupTypes: [TaxonomicFilterGroupType.Events, TaxonomicFilterGroupType.Actions],})- await waitFor(() => {- expect(screen.getByTestId('prop-filter-events-0')).toBeInTheDocument()- })+ await screen.findByTestId('taxonomic-category-dropdown-trigger-pill')// Pill auto-injects the "All" (SuggestedFilters) tab as the default for a// multi-group picker, so that's the category showing before and after Tab.diff --git a/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.tsx b/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.tsxindex 6fa956cf3328..c9e9b8940eff 100644--- a/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.tsx+++ b/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.tsx@@ -1,7 +1,7 @@import './TaxonomicFilter.scss'import clsx from 'clsx'-import { BindLogic, useActions, useValues } from 'kea'+import { BindLogic, batchChanges, useActions, useValues } from 'kea'import { forwardRef, useEffect, useId, useRef, useState } from 'react'import { Link } from '@posthog/lemon-ui'@@ -217,11 +217,12 @@ export const TaxonomicFilterSearchInput = forwardRef<} = useActions(taxonomicFilterLogic)const _onChange = (query: string): void => {+ // Batch the search query update to reduce re-renders while keeping the controlled input responsive.+ batchChanges(() => setTaxonomicSearchQuery(query))// Only the input's onChange path counts as user interaction. The controlled-prop// useEffect above also calls setSearchQuery directly, but that's programmatic and// shouldn't unmute the `taxonomic filter closed` capture — keep this dispatch separate.markUserInteraction()- setTaxonomicSearchQuery(query)onChange?.(query)}diff --git a/frontend/src/lib/components/TaxonomicFilter/infiniteListLogic.test.ts b/frontend/src/lib/components/TaxonomicFilter/infiniteListLogic.test.tsindex eeddf816fceb..1fbc7c37be16 100644--- a/frontend/src/lib/components/TaxonomicFilter/infiniteListLogic.test.ts+++ b/frontend/src/lib/components/TaxonomicFilter/infiniteListLogic.test.ts@@ -101,6 +101,75 @@ describe('infiniteListLogic', () => {return logicWithProps}+ it.each([+ { state: 'initial request pending', initialCompleted: false, previousSearchPending: false, clear: false },+ { state: 'initial request completed', initialCompleted: true, previousSearchPending: false, clear: false },+ { state: 'previous search pending', initialCompleted: true, previousSearchPending: true, clear: false },+ { state: 'clearing during initial load', initialCompleted: false, previousSearchPending: false, clear: true },+ ])('debounces each query change with $state', async ({ initialCompleted, previousSearchPending, clear }) => {+ const searches: string[] = []+ let completeInitial!: () => void+ const initialResponse = new Promise<void>((resolve) => {+ completeInitial = resolve+ })+ let completePreviousSearch!: () => void+ const previousSearchResponse = new Promise<void>((resolve) => {+ completePreviousSearch = resolve+ })+ useMocks({+ get: {+ '/api/projects/:team/event_definitions': async ({ request }) => {+ const search = new URL(request.url).searchParams.get('search') ?? ''+ searches.push(search)+ if (!search) {+ await initialResponse+ }+ if (search === 'prior') {+ await previousSearchResponse+ }+ return [200, { results: [{ name: search || 'initial_event' }], count: 1 }]+ },+ },+ })+ jest.useFakeTimers()+ const searchLogic = logicWith({})+ try {+ await jest.advanceTimersByTimeAsync(1)+ expect(searches).toEqual([''])+ if (initialCompleted) {+ completeInitial()+ await jest.advanceTimersByTimeAsync(0)+ expect(searchLogic.values.remoteItems.first).toBeFalsy()+ }+ if (previousSearchPending) {+ searchLogic.actions.setSearchQuery('prior')+ await jest.advanceTimersByTimeAsync(500)+ expect(searches).toEqual(['', 'prior'])+ }+ const beforeTyping = [...searches]+ const queries = clear ? ['e', 'em', 'e', ''] : ['e', 'em', 'ema', 'emai', 'email']+ const finalQuery = queries[queries.length - 1]+ for (const query of queries) {+ searchLogic.actions.setSearchQuery(query)+ await jest.advanceTimersByTimeAsync(100)+ }+ expect(searchLogic.values.searchQuery).toBe(finalQuery)+ expect(searches).toEqual(beforeTyping)+ await jest.advanceTimersByTimeAsync(399)+ expect(searches).toEqual(beforeTyping)+ await jest.advanceTimersByTimeAsync(1)+ expect(searches).toEqual([...beforeTyping, finalQuery])+ completeInitial()+ completePreviousSearch()+ await jest.advanceTimersByTimeAsync(0)+ expect(searchLogic.values.remoteItems.searchQuery).toBe(finalQuery)+ } finally {+ completeInitial()+ completePreviousSearch()+ jest.useRealTimers()+ }+ })+describe('index', () => {it('defaults to 0 when whether the first item should be selected is not specified', async () => {await expectLogic(logicWith({})).toMatchValues({diff --git a/frontend/src/lib/components/TaxonomicFilter/infiniteListLogic.ts b/frontend/src/lib/components/TaxonomicFilter/infiniteListLogic.tsindex b737ed09b3d9..ddbe69e3081c 100644--- a/frontend/src/lib/components/TaxonomicFilter/infiniteListLogic.ts+++ b/frontend/src/lib/components/TaxonomicFilter/infiniteListLogic.ts@@ -210,6 +210,7 @@ const createEmptyListStorage = (searchQuery = '', first = false): ListStorage =>// simple cache with a setTimeout expiryconst API_CACHE_TIMEOUT = 60000+const SEARCH_DEBOUNCE_MS = 500// Well under the gateway's own ceiling, so a wedged list request surfaces as a retryable error// here rather than spinning until the proxy returns a 504.const REMOTE_ITEMS_REQUEST_TIMEOUT_MS = 30000@@ -866,8 +867,10 @@ export const infiniteListLogic = kea<infiniteListLogicType>([createEmptyListStorage('', true),{loadRemoteItems: async ({ offset, limit }, breakpoint) => {- if (!values.remoteItems.first) {- await breakpoint(500)+ const isInitialLoad = !cache.hasStartedRemoteLoad+ cache.hasStartedRemoteLoad = true+ if (!isInitialLoad || values.searchQuery) {+ await breakpoint(SEARCH_DEBOUNCE_MS)} else {// These connected values below might be read before they are available due to circular logic mounting.// Adding a slight delay (breakpoint) fixes this.@@ -2192,13 +2195,13 @@ export const infiniteListLogic = kea<infiniteListLogicType>([const searchQueryChanged = cache.lastSearchQuery !== values.searchQuerycache.lastSearchQuery = values.searchQuery- if (searchQueryChanged) {+ if (searchQueryChanged && (values.pinnedRowIndex !== null || values.hasAppliedInitialPin)) {actions.resetPinnedRowState()}if (values.hasRemoteDataSource) {actions.loadRemoteItems({ offset: 0, limit: values.limit })} else {- if (props.autoSelectItem) {+ if (props.autoSelectItem && values.index !== 0) {actions.setIndex(0)}if (props.listGroupType !== TaxonomicFilterGroupType.SuggestedFilters) {@@ -2296,8 +2299,13 @@ export const infiniteListLogic = kea<infiniteListLogicType>([})}},- infiniteListResultsReceived: () => {- actions.reconcilePinnedRowState()+ infiniteListResultsReceived: ({ groupType }) => {+ if (+ groupType === props.listGroupType ||+ props.listGroupType === TaxonomicFilterGroupType.SuggestedFilters+ ) {+ actions.reconcilePinnedRowState()+ }},applyInitialPinnedRow: ({ rowIndex }) => {actions.setIndex(rowIndex)