ProgrammerHumor

aThousandLinesDropdownMenu

aThousandLinesDropdownMenu

Context: I could have easily made it under 100 lines, but the 1000 lines for a dropdown is actually more easily managed, I learned the lesson of life,

"Somethings are better off being a Spaghetti "

https://i.redd.it/tjndyzpth3df1.png
Reddit

Discussion

MinosAristos
:py: :ts: :cs:

If your solution for making it under 100 would have been pulling out a bunch of single-use components then my personal preference would also be to keep it at 1000.

Single-use components have their uses (you definitely need some e.g for distinct pages) but they feel way overused and often lead to a ton of unnecessary prop drilling.

1 day ago
VAIDIK_SAVALIYA OP

EXACTLY! my friend

Plus it would have increased the data layers by making abstractions, and since it has a bunch of functions which are only used once like language switcher (i am not using it anywhere because dropdown is visible on all pages) then there is no need for making different files.

1 day ago
powerhcm8

I wouldn't try to make a bunch of single use components but maybe try to use a loop create the dropdown items, and an array of items with things like label, icon, state and command function for action.

The dropdowns in my current system aren't that big and I am already thing about doing this.

1 day ago
MeltedChocolate24
:c::j::ts::py::js:

This is why I have a 6k line component

21 hours ago
SkurkDKDKDK

I just love When devs are showcasing code. There’s jackpot for “I haven’t optimized the code” every time 😂

1 day ago
VAIDIK_SAVALIYA OP

hahaha, true

1 day ago
LavaCreeperBOSSB

I know shadcn when I see it

22 hours ago
VAIDIK_SAVALIYA OP

We are alike, infact any component with Content will be shadcn forsure,

22 hours ago
1_4_1_5_9_2_6_5
:ts::js::p::j:

I see you're just tightly coupled to shadcn, no attempt to wrap the drop down... fighing this in my current codebase, with hundreds of shadcn components with completely different implementations

13 hours ago
VAIDIK_SAVALIYA OP

Can you elaborate on problems? I am yet to face any

13 hours ago
1_4_1_5_9_2_6_5
:ts::js::p::j:

Cannot procedurally generate forms even though all the logic is there, because inputs are not consistent

No central handling of theming and theme change management

Context switching between components like this Dropdown with its various child components, vs a Select with prop based handling, etc

Source code is unintuitive so devs have to trawl through shadcn docs and tutorials just to learn how to use one internal component, and then do it again for every other one because they're all slightly different

Consistency matters in a large codebase, and these make it very difficult (or the dev who did it didn't put any thought into it)

13 hours ago
sinisterzek

I’d say this is more radix’s issue than shadcn’s tbh

6 hours ago
VAIDIK_SAVALIYA OP

Ahh i understand,

I will try to recreate some of problems, but yes the docs crawling makes sense

13 hours ago