-
Notifications
You must be signed in to change notification settings - Fork 153
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(server-routes): add global default inputs #321
feat(server-routes): add global default inputs #321
Conversation
const parsedQuery = computed(() => { | ||
return { | ||
...parseInputs(routeInputs.query), | ||
...parseInputs(globalInputs.value.query), |
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 think the global input should have lower priority than local inputs
packages/devtools/src/constant.ts
Outdated
@@ -39,5 +39,10 @@ export const defaultTabOptions: NuxtDevToolsOptions = { | |||
serverRoutes: { | |||
selectedRoute: null, | |||
view: 'tree', | |||
globalInputs: { |
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.
It seems this default object isn't merged deep, and causing undefined
error when first access
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.
Also, maybe name it inputDefaults
than globalInputs
?
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.
@antfu thanks for the points <3, I did resolve them except I'm not sure what is causing the undefined
error(Tried the tab-server-route playground
with no fs storage, and didn't get any error)
would changing the type of inputDefaults
in options.ts
help?
inputDefaults: Record<string, ServerRouteInput[]>
to
inputDefaults: { query: ServerRouteInput[] body: ServerRouteInput[] headers: ServerRouteInput[] }
7beb93c
to
9e115c8
Compare
ability to add global inputs and save it on storage options
global-inputs-demo.mp4