-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: new console pages for config, data, database, enum, secret, and typealias #2617
Conversation
const schema = useSchema() | ||
const decl = useMemo(() => { | ||
const modules = (schema?.data || []) as PullSchemaResponse[] | ||
const module = modules.find((m: PullSchemaResponse) => m.moduleName === moduleName) | ||
if (!module?.schema) { | ||
return | ||
} | ||
return module.schema.decls.find((d) => d.value.value?.name === declName) | ||
}, [moduleName, declName, schema?.data]) | ||
|
||
const str = moduleName ? `${moduleName}.${declName}` : declName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been personally finding that it's easier to make "dumb" components and feed the data into them, vs. having to have useSchema
type hooks in the smaller sub components. This also makes them much easier to write storybook
stories for since they don't have any real dependencies. Whatcha think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normally I follow that pattern too, but in this case, DeclLink
is used by TypeEl
, which in turn is used by most of the decl-type panels. We'd end up having to thread it through all the way, which would make the props for all of those components more complicated just for only DeclLink
to actually use the contents. It gets worse from there, because DeclLink
is probably going to end up all over the console once we're through, at which point we're basically passing schema
down through nearly every single component in the tree. That would almost completely defeat the purpose of the hook pattern to begin with. :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! Yeah, definitely seems easier to keep this here then. Thanks for the clarification!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Niiiiice! This is awesome
Part 1 of #2616
Adds (or significantly adds to) pages for the following decl types:
Not yet added: FSM, topic, subscription
Adds components for:
DeclLink
: takes a ref and links to the page for that declTypeEl
: renders an appropriate string for a given Type, with links if appropriatePanelHeader
renders the standard decl panel page header (e.g. comments, export badge)