Skip to content

Commit

Permalink
chore: fix empty second step
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas-jonas committed Nov 15, 2024
1 parent e633103 commit aeb715f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export function OryTwoStepCard() {
? getFinalNodes(uniqueGroups.groups, formState.method)
: []

console.log(formState)
return (
<OryCard>
<OryCardHeader />
Expand Down Expand Up @@ -88,6 +87,11 @@ export function OryTwoStepCard() {
)}
{formState.current === "method_active" && (
<>
{ui.nodes
.filter((n) => n.type === "script")
.map((node, k) => (
<Node node={node} key={k} />
))}
{finalNodes.sort(sortNodes).map((node, k) => (
<Node node={node} key={k} />
))}
Expand Down
4 changes: 2 additions & 2 deletions packages/elements-react/src/context/form-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ function parseStateFromFlow(flow: OryFlowContainer): FormState {
return { current: "method_active", method: "link" }
} else if (flow.flow.active == "code_recovery") {
return { current: "method_active", method: "code" }
} else if (flow.flow.active) {
return { current: "method_active", method: flow.flow.active }
} else if (isChoosingMethod(flow.flow.ui.nodes)) {
return { current: "select_method" }
} else if (flow.flow.active) {
return { current: "method_active", method: flow.flow.active }
}
return { current: "provide_identifier" }
case FlowType.Recovery:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright © 2024 Ory Corp
// SPDX-License-Identifier: Apache-2.0

import { useIntl } from "react-intl"
import { OryCardAuthMethodListItemProps } from "@ory/elements-react"
import { useIntl } from "react-intl"
import code from "../../assets/icons/code.svg"
import passkey from "../../assets/icons/passkey.svg"
import password from "../../assets/icons/password.svg"
Expand Down
8 changes: 6 additions & 2 deletions packages/elements-react/src/util/ui/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ export function triggerToWindowCall(

// Retry every 250ms for 5 seconds
let i = 0
const ms = 250
const ms = 100
const interval = setInterval(() => {
i++
if (i > 20) {
if (i > 100) {
clearInterval(interval)
throw new Error(
"Unable to load Ory's WebAuthn script. Is it being blocked or otherwise failing to load? If you are running an old version of Ory Elements, please upgrade. For more information, please check your browser's developer console.",
Expand Down Expand Up @@ -107,6 +107,10 @@ export function useNodesGroups(nodes: UiNode[]) {
const groups: Partial<Record<UiNodeGroupEnum, UiNode[]>> = {}

for (const node of nodes) {
if (node.type === "script") {
// WebAuthn scripts are part of the nodes, for passkey flows
continue
}
const groupNodes = groups[node.group] ?? []
groupNodes.push(node)
groups[node.group] = groupNodes
Expand Down

0 comments on commit aeb715f

Please sign in to comment.