-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
fix: conflict between rewrite and actions middleware #11052
Conversation
🦋 Changeset detectedLatest commit: 960c8d4 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
Question about a conditional check for the success case. Also curious what is triggering the reassignment? Is it an object spread?
Well I think the case is kinda tricky but basically, I have this middleware (context, next) => {
context.locals.data = null
context.locals.foo = async (data) => {
context.locals.data = data
return await next("/bar")
}
return next()
} then I can call it in an astro route: return await Astro.locals.bar("abc") I need to call |
Changes
locals._actionsInternal
is reassigned can occur. However, there's a protection to disable reassigning it so it fails. This PR does not attempt to reassign if it already existsTesting
Manual patch in a private project
Docs
N/A, bug fix