itaditya/solid-command-palette

Possible to Dynamically Load Command Palette Content?

Opened this issue · 3 comments

Just curious if there is an option to dynamically add actions to the command palette. I was able to modify the <Root> actions parameter to accept a Solid signal and then dynamically add actions using a generic timeout. But I couldn't seem add actions more than once.

I am very new to SolidJS - and never learned much of React. I would be interested in some kind of collaboration on this front as this will end up in a production environment.

(Edited for clarity)

The way it's designed you need to register all the actions upfront but you can choose to enable actions conditionally so they don't show up at the start.

Also an action can receive dynamic data from the active component tree. Example- https://github.com/itaditya/solid-command-palette/blob/main/src/app/views/demo/DynamicActionContextDemo/DynamicActionContextDemo.tsx#L39

Thank you for the example. I will check it out.

Basically I am looking to offer some routing capability to quickly jump to portions of the application based on a GUID - but the set of possible routes is dynamic through the life-cycle of the application requiring at minimum for the command palette to know the GUID and title.

Do you think this would be possible? ( I will take a look at the code in the meantime )

My current implementation:
I have a parent component that is basically like "Open". Then a list of possible destinations appear as child items to choose to navigate to. But the list of options must be dynamic as the application state changes constantly.

(Edit: Added example)

Got it, currently it's only possible if at the start of app you can create a list of routes but then disable the disallowed ones conditionally