Skip to content

Commit 9b200ab

Browse files
hperlory-bot
authored andcommitted
fix: use formState dispatcher in registration footer
GitOrigin-RevId: 593b088e0815b6a3fefc50c446c812d7f9de7eb1
1 parent 590e5b4 commit 9b200ab

File tree

5 files changed

+11
-14
lines changed

5 files changed

+11
-14
lines changed

packages/elements-react/src/components/form/social.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,7 @@ export function OryFormOidcButtons() {
6666
export function OryFormSocialButtonsForm() {
6767
const {
6868
flow: { ui },
69-
formState,
7069
} = useOryFlow()
71-
console.log(formState)
7270

7371
// Only get the oidc nodes.
7472
const filteredNodes = ui.nodes.filter(

packages/elements-react/src/context/config.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ export function OryConfigurationProvider({
9797

9898
function computeSdkConfig(config?: OryClientConfiguration["sdk"]): SDKConfig {
9999
if (config?.url && typeof config.url === "string") {
100-
console.debug("Using sdk url from config")
101100
return {
102101
url: config.url.replace(/\/$/, ""),
103102
options: config.options || {},

packages/elements-react/src/theme/default/components/card/footer.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ function LogoutButton({ returnTo }: LogoutButtonProps) {
190190

191191
function RegistrationCardFooter() {
192192
const intl = useIntl()
193-
const { flow, formState } = useOryFlow()
193+
const { flow, formState, dispatchFormState } = useOryFlow()
194194
const config = useOryConfiguration()
195195
const visibleGroups = useNodeGroupsWithVisibleNodes(flow.ui.nodes)
196196
const authMethodBlocks = toAuthMethodPickerOptions(visibleGroups)
@@ -203,19 +203,22 @@ function RegistrationCardFooter() {
203203
}
204204

205205
return (
206-
<span className="font-normal leading-normal antialiased">
207-
<a
208-
className="font-medium text-button-link-brand-brand hover:text-button-link-brand-brand-hover"
209-
// This works, because it essentially reloads the page.
210-
// TODO: this should not do a full reload, but rather just update the state.....
211-
href=""
206+
<span className="font-normal leading-normal antialiased text-interface-foreground-default-primary">
207+
<button
208+
className="text-button-link-brand-brand transition-colors hover:text-button-link-brand-brand-hover underline"
209+
onClick={() => {
210+
dispatchFormState({
211+
type: "action_clear_active_method",
212+
})
213+
}}
212214
data-testid={"ory/screen/registration/action/selectMethod"}
215+
type="button"
213216
>
214217
{intl.formatMessage({
215218
id: "card.footer.select-another-method",
216219
defaultMessage: "Select another method",
217220
})}
218-
</a>
221+
</button>
219222
</span>
220223
)
221224
case "select_method":

packages/elements-react/src/theme/default/components/settings/settings-oidc.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ function UnlinkRow({ button }: UnlinkRowProps) {
8080
}
8181
}, [isSubmitting, setClicked])
8282

83-
console.log(button.meta.label?.context)
84-
8583
return (
8684
<div key={attrs.value} className="flex justify-between">
8785
<div className="flex items-center gap-6">

packages/elements-react/src/util/sdk-helpers/continueWith.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ export function handleContinueWith(
4747
if (isSetOrySessionToken(action)) {
4848
throw new Error("Ory Elements does not support API flows yet.")
4949
} else if (isRedirectBrowserTo(action) && action.redirect_browser_to) {
50-
// console.log("Redirecting to", action.redirect_browser_to)
5150
onRedirect(action.redirect_browser_to, true)
5251
return true
5352
} else if (isShowVerificationUi(action)) {

0 commit comments

Comments
 (0)