-
-
Notifications
You must be signed in to change notification settings - Fork 97
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: Button.Redirect #49
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
src/components/Button.tsx
Outdated
location && ( | ||
<meta property={`fc:frame:button:${index}:target`} content={location} /> | ||
target && ( | ||
<meta property={`fc:frame:button:${index}:target`} content={target} /> |
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.
target
is where to post the action to get the location
if (context.status === 'redirect' && context.buttonIndex) { | ||
const buttonValue = buttonValues[context.buttonIndex - 1] | ||
const location = buttonValue?.replace(/^_r:/, '') | ||
if (!location) throw new Error('location required to redirect') | ||
return c.redirect(location, 302) | ||
} |
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.
Needed to move this down so we have resolved buttonValues
based on the context
from the current action. Otherwise, redirect location
is based on old context values.
Button.Redirect
isn't working with dynamic content. This PR fixes that.TODO: Still need to make sure
target
works correctly across frames.