-
Notifications
You must be signed in to change notification settings - Fork 329
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 subscription success page #636
Conversation
WalkthroughThe changes in the Changes
Possibly related PRs
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
client/pages/subscriptions/success.vue (1)
Line range hint
47-53
: Consider implementing a more robust polling mechanismThe current implementation polls every 5 seconds indefinitely until subscription is confirmed. Consider these improvements:
- Add a maximum retry count to prevent infinite polling
- Implement exponential backoff
- Add a timeout for the entire polling operation
Here's a suggested implementation:
+const MAX_RETRIES = 12 // 1 minute maximum (5s * 12) +const retryCount = ref(0) const checkSubscription = () => { // Fetch the user. return opnFetch('user').then((data) => { authStore.setUser(data) redirectIfSubscribed() + retryCount.value++ + if (retryCount.value >= MAX_RETRIES) { + clearInterval(interval.value) + console.warn('Subscription check timed out') + } }).catch((error) => { console.error(error) clearInterval(interval.value) }) }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
client/pages/subscriptions/success.vue
(1 hunks)
🔇 Additional comments (1)
client/pages/subscriptions/success.vue (1)
47-47
: Verify API compatibility between noteFormsFetch
and opnFetch
Please ensure that opnFetch
maintains the same authentication headers and response structure as noteFormsFetch
to prevent any authentication or data parsing issues.
✅ Verification successful
The change from noteFormsFetch
to opnFetch
is safe and maintains API compatibility
Based on the codebase analysis:
opnFetch
is a well-established utility used consistently across the codebase for user-related operations- It properly handles authentication through
getOpnRequestsOptions
which sets appropriate headers - The function is already being used for user data fetching in multiple components including billing, authentication, and user management
- The
/user
endpoint is called withopnFetch
in several other places with the same pattern
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for both fetch implementations to compare their configurations
echo "Searching for fetch implementations..."
rg -A 10 "const noteFormsFetch|const opnFetch" --type vue --type js --type ts
# Look for their usage patterns
echo "Analyzing usage patterns..."
rg "noteFormsFetch\(|opnFetch\(" --type vue --type js --type ts
Length of output: 353
Script:
#!/bin/bash
# Search for both fetch implementations with correct file type
echo "Searching for fetch implementations..."
rg -A 10 "const noteFormsFetch|const opnFetch"
# Look for their usage patterns
echo "Analyzing usage patterns..."
rg "noteFormsFetch\(|opnFetch\("
# Search for any fetch-related utility files
echo "Searching for fetch utility files..."
fd "fetch" --type f
Length of output: 7552
Script:
#!/bin/bash
# Check the implementation of getOpnRequestsOptions to verify authentication headers
echo "Checking opnFetch implementation details..."
rg -A 15 "getOpnRequestsOptions"
# Look for noteFormsFetch implementation
echo "Searching for noteFormsFetch implementation..."
fd -e js -e ts -e vue | xargs rg "noteFormsFetch"
# Check if there are any imports of noteFormsFetch
echo "Checking noteFormsFetch imports..."
rg "import.*noteFormsFetch"
Length of output: 1725
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
client/components/open/forms/components/FormEditorErrorHandler.vue (1)
72-73
: LGTM with a minor formatting suggestionThe branding update from "NoteForms" to "OpnForm" is correctly implemented. However, the message formatting could be improved for better readability.
Consider applying this formatting improvement:
- crisp.showMessage(`Hi there, we're very sorry to hear you experienced an issue with OpnForm. - We'll be in touch about it very soon! In the meantime, I recommend that you try going back one step, and save your changes.`, 2000) + crisp.showMessage( + "Hi there, we're very sorry to hear you experienced an issue with OpnForm. " + + "We'll be in touch about it very soon! In the meantime, I recommend that you try going back one step, and save your changes.", + 2000 + )This change:
- Removes template literal in favor of string concatenation for better readability
- Eliminates unnecessary indentation in the message
- Maintains the same message content and timing
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
client/components/open/forms/components/FormEditorErrorHandler.vue
(1 hunks)client/pages/home.vue
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- client/pages/home.vue
Summary by CodeRabbit
New Features
Bug Fixes
Refactor