Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/docs/src/lib/excerpt-renderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function renderExcerpt(excerpt: string): React.ReactNode {
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&#039;")
.replace(/'/g, "&#39;")

if (inMark) {
elements.push(
Expand Down Expand Up @@ -51,5 +51,5 @@ export function getExcerptText(excerpt: string): string {
.replace(/&lt;/g, "<")
.replace(/&gt;/g, ">")
.replace(/&quot;/g, '"')
.replace(/&#039;/g, "'")
.replace(/&#39;/g, "'")
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ import type { OhlcBar } from "../../lib/oracle"
import { useWalletStore } from "@/features/wallet/store/wallet-store"
import { formatUsd } from "@/shared/lib/format"
import { ENV } from "@/app/config/env"
import type { CandlestickData, IChartApi, IPriceLine, ISeriesApi, UTCTimestamp } from "lightweight-charts"
import type { OhlcBar } from "../../lib/oracle"
import { useWalletStore } from "@/features/wallet/store/wallet-store"

type ChartLine = {
id: string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState, useEffect } from "react"
import { useEffect, useState } from "react"
import { ORDER_EXECUTION_FROZEN_MESSAGE } from "@/lib/contracts"

const SESSION_KEY = "so4-order-execution-frozen-dismissed"
Expand All @@ -12,7 +12,7 @@ export function OrderExecutionFrozenBanner({ visible }: Props) {

useEffect(() => {
try {
if (typeof window !== "undefined" && sessionStorage) {
if (typeof window !== "undefined") {
setDismissed(sessionStorage.getItem(SESSION_KEY) === "1")
}
} catch {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useEffect, useMemo, useState } from "react"
import { explorerTxUrl } from "@/app/config/network"
import {
Tabs,
TabsContent,
Expand Down Expand Up @@ -27,6 +26,7 @@ import { ConfirmationDialog } from "./ConfirmationDialog"
import { ApplyReferralCodePrompt } from "./ApplyReferralCodePrompt"
import { LeverageSlider } from "./LeverageSlider"
import type { TradeMode, TradeType, useTradeState } from "../../hooks/useTradeState"
import { explorerTxUrl } from "@/app/config/network"
import { NumberInput } from "@/shared/components/NumberInput"
import { useWalletStore } from "@/features/wallet/store/wallet-store"
import { TokenIcon } from "@/shared/components/TokenIcon"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState, useEffect } from "react"
import { useEffect, useState } from "react"
import { useLocation } from "@tanstack/react-router"
import { useNetwork } from "../hooks/useNetwork"
import { useWalletStore } from "../store/wallet-store"
Expand All @@ -14,7 +14,7 @@ export function NetworkMismatchBanner() {

useEffect(() => {
try {
if (typeof window !== "undefined" && sessionStorage) {
if (typeof window !== "undefined") {
setDismissed(sessionStorage.getItem(SESSION_KEY) === "1")
}
} catch {
Expand Down
6 changes: 3 additions & 3 deletions apps/web/src/shared/hooks/useTxFeedback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useCallback, useRef } from "react"
import { toast } from "@workspace/ui/components/toast"
import { explorerTxUrl } from "@/app/config/network"

// #732: Explicit lifecycle events for transaction feedback without English message matching
// Issue 732: Explicit lifecycle events for transaction feedback without English message matching
export type TxFeedbackEvent =
| { type: "signing"; message: string }
| { type: "signed" }
Expand All @@ -15,7 +15,7 @@ export type TxFeedbackEvent =
| { type: "error"; message: string }
| { type: "unknown_outcome"; hash?: string }

// #732: Each attempt gets its own stable toast ID; concurrent transactions don't interfere
// Issue 732: Each attempt gets its own stable toast ID; concurrent transactions don't interfere
type TxAttempt = {
readonly attemptId: string
readonly createdAt: number
Expand Down Expand Up @@ -143,7 +143,7 @@ export function useTxFeedback() {
break

case "unknown_outcome":
// #733: Unknown submission outcome — status should be looked up by hash if available
// Issue 733: Unknown submission outcome — status should be looked up by hash if available
attempt.status = "submitted"
if (attempt.toastId) {
toast.show({
Expand Down
22 changes: 11 additions & 11 deletions apps/web/src/shared/hooks/useTxSubmit.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useCallback, useState, useRef } from "react"
import { useCallback, useRef, useState } from "react"
import { toast } from "@workspace/ui/components/toast"
import { useTxFeedback } from "./useTxFeedback"
import { sendAndPoll } from "@/lib/tx-builder"
import { explorerTxUrl } from "@/app/config/network"
import { useTxFeedback } from "./useTxFeedback"

export type SubmitTxOptions = {
loadingMessage: string
Expand Down Expand Up @@ -81,14 +81,14 @@ export function useTxSubmit() {
error: null,
})
const feedback = useTxFeedback()
// #733: Track attempt identity to detect and prevent duplicate submissions
// Issue 733: Track attempt identity to detect and prevent duplicate submissions
const attemptIdRef = useRef<string | null>(null)
// #733: Guard against double-click, Enter+click, component rerender triggering multiple submissions
// Issue 733: Guard against double-click, Enter+click, component rerender triggering multiple submissions
const submitInProgressRef = useRef(false)

const submit = useCallback(
async (getSignedXdr: () => Promise<string>, options: SubmitTxOptions): Promise<string> => {
// #733: Prevent duplicate submission (double-click, accidental Enter+click, rerender)
// Issue 733: Prevent duplicate submission (double-click, accidental Enter+click, rerender)
if (submitInProgressRef.current) {
throw new Error("Submission already in progress")
}
Expand All @@ -113,15 +113,15 @@ export function useTxSubmit() {
[],
)

// #732: Extended submit that integrates with transaction feedback controller
// Issue 732: Extended submit that integrates with transaction feedback controller
const submitWithFeedback = useCallback(
async (getSignedXdr: () => Promise<string>, options: SubmitTxOptions): Promise<string> => {
const attemptId = `txn-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`
attemptIdRef.current = attemptId

const attempt = feedback.createAttempt(attemptId)
feedback.createAttempt(attemptId)

// #733: Prevent duplicate submission with attempt tracking
// Issue 733: Prevent duplicate submission with attempt tracking
if (submitInProgressRef.current) {
feedback.handleEvent({
type: "error",
Expand All @@ -144,7 +144,7 @@ export function useTxSubmit() {
const response = await sendAndPoll(signedXdr)
return response.hash
} catch (submitError) {
// #733: Unknown submission outcome — signal for status lookup
// Issue 733: Unknown submission outcome — signal for status lookup
const errorMsg = submitError instanceof Error ? submitError.message : "Submission failed"
if (errorMsg.includes("unknown")) {
feedback.handleEvent({ type: "unknown_outcome" })
Expand Down Expand Up @@ -181,7 +181,7 @@ export function useTxSubmit() {
submitInProgressRef.current = false
throw error
} finally {
// #733: Keep attempt ID for status lookup in case of unknown outcomes
// Issue 733: Keep attempt ID for status lookup in case of unknown outcomes
// Do NOT clear immediately — let status lookup use it if needed
}
},
Expand All @@ -190,7 +190,7 @@ export function useTxSubmit() {

return {
submit,
// #732 & #733: Extended submit with transaction feedback controller
// Issues 732 and 733: Extended submit with transaction feedback controller
submitWithFeedback,
isLoading: state.isLoading,
txHash: state.txHash,
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/ui/theme-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function ThemeProvider({ children }: { children: ReactNode }) {
resolve(next) === resolve(theme) ||
window.matchMedia("(prefers-reduced-motion: reduce)").matches ||
document.documentElement.dataset.reducedMotion === "true" ||
!document.startViewTransition
!Reflect.has(document, "startViewTransition")
) {
activeTransition.current?.skipTransition()
apply()
Expand Down