Allow clearing old LBC comment limits from Odysee#3408
Conversation
📝 WalkthroughWalkthroughAdds debounced LBC min-tip updates and cross-field synchronization between LBC and USD tip/super fields; full-sync now sets LBC fields (minTip, minSuper) when appropriate and USD changes clear legacy LBC values to avoid conflicting inputs. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In
`@ui/page/claim/internal/claimPageComponent/internal/channelPage/tabs/creatorSettingsTab/view.jsx`:
- Around line 168-170: The file uses Flow type annotations in the function
pushMinTip (parameters value: number and activeChannelClaim: ChannelClaim) which
Biome isn't configured to parse; either enable Flow support in the Biome parser
config or remove/replace the Flow annotations in this file (e.g., strip the ":
number" and ": ChannelClaim" from pushMinTip and any other Flow types, or add
Flow parser/enablement to biome.json) so the parser no longer fails when
handling updateCreatorSettings and pushMinTip.
| function pushMinTip(value: number, activeChannelClaim: ChannelClaim) { | ||
| updateCreatorSettings(activeChannelClaim, { min_tip_amount_comment: value }); | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Inspect Biome configuration to verify Flow/JSX parsing support.
echo "=== Searching for Biome config files ==="
fd -a -t f 'biome.json' -x sh -c 'echo "---- $1 ----"; cat "$1"' sh {} \;
fd -a -t f 'biome.jsonc' -x sh -c 'echo "---- $1 ----"; cat "$1"' sh {} \;
fd -a -t f 'biome.json5' -x sh -c 'echo "---- $1 ----"; cat "$1"' sh {} \;
echo ""
echo "=== Checking target file ==="
cat -n ui/page/claim/internal/claimPageComponent/internal/channelPage/tabs/creatorSettingsTab/view.jsx | sed -n '160,180p'Repository: OdyseeTeam/odysee-frontend
Length of output: 2930
Biome parser configuration missing Flow support — will cause CI failures.
The biome.json configuration lacks Flow parser enablement, but this .jsx file uses Flow type annotations (value: number, activeChannelClaim: ChannelClaim). Configure Biome to support Flow syntax or remove the Flow annotations from this file.
🧰 Tools
🪛 Biome (2.3.13)
[error] 168-168: Type annotations are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.
TypeScript only syntax
(parse)
[error] 168-168: Type annotations are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.
TypeScript only syntax
(parse)
🤖 Prompt for AI Agents
In
`@ui/page/claim/internal/claimPageComponent/internal/channelPage/tabs/creatorSettingsTab/view.jsx`
around lines 168 - 170, The file uses Flow type annotations in the function
pushMinTip (parameters value: number and activeChannelClaim: ChannelClaim) which
Biome isn't configured to parse; either enable Flow support in the Biome parser
config or remove/replace the Flow annotations in this file (e.g., strip the ":
number" and ": ChannelClaim" from pushMinTip and any other Flow types, or add
Flow parser/enablement to biome.json) so the parser no longer fails when
handling updateCreatorSettings and pushMinTip.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In
`@ui/page/claim/internal/claimPageComponent/internal/channelPage/tabs/creatorSettingsTab/view.jsx`:
- Around line 404-405: The input's value prop for the USDT tip field (using
minUSDTip and minTip) can flip between controlled and uncontrolled because it
returns undefined for empty values; change the value expression so it never
yields undefined (use an empty string '' for empty state) and ensure the
corresponding onChange handlers and state (minUSDTip) accept/normalize '' vs
numeric values; apply the same change to the other occurrence around the
minUSDTip/minTip value usage at the referenced second site (lines 450-451) so
both inputs remain controlled.
🧹 Nitpick comments (1)
ui/page/claim/internal/claimPageComponent/internal/channelPage/tabs/creatorSettingsTab/view.jsx (1)
415-423: Optional: dedupe legacy LBC clearing logic.
The same block is repeated in both handlers; a helper reduces duplication and future drift.♻️ Suggested refactor
+ function clearLegacyLbcLimits() { + if (minTip !== 0) { + setMinTip(0); + pushMinTipDebounced(0, activeChannelClaim); + } + if (minSuper !== 0) { + setMinSuper(0); + pushMinSuperDebounced(0, activeChannelClaim); + } + } ... - if (minTip !== 0) { - setMinTip(0); - pushMinTipDebounced(0, activeChannelClaim); - } - if (minSuper !== 0) { - setMinSuper(0); - pushMinSuperDebounced(0, activeChannelClaim); - } + clearLegacyLbcLimits(); ... - if (minTip !== 0) { - setMinTip(0); - pushMinTipDebounced(0, activeChannelClaim); - } - if (minSuper !== 0) { - setMinSuper(0); - pushMinSuperDebounced(0, activeChannelClaim); - } + clearLegacyLbcLimits();Also applies to: 456-464
If user has set LBC comment limits in the past, we show $0.01 limit on UI.
There wasn't a way to clear that from settings, so updated settings to match the other UI.
-If user has LBC min tip set, it shows as the $0.01 in settings too.
-Changing the minUSD tip/hyperchat, will set both LBC limits to 0.
Summary by CodeRabbit