-
Notifications
You must be signed in to change notification settings - Fork 297
Don't show copy page where prompt.md is present #2683
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
Merged
+13
−6
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
🧩 Analysis chain
🏁 Script executed:
Repository: appwrite/website
Length of output: 4702
🏁 Script executed:
Repository: appwrite/website
Length of output: 90
🏁 Script executed:
Repository: appwrite/website
Length of output: 945
🏁 Script executed:
Repository: appwrite/website
Length of output: 3191
🏁 Script executed:
Repository: appwrite/website
Length of output: 89
🏁 Script executed:
Repository: appwrite/website
Length of output: 501
🏁 Script executed:
Repository: appwrite/website
Length of output: 468
🏁 Script executed:
Repository: appwrite/website
Length of output: 89
🏁 Script executed:
# Read the entire routePrompts.ts file cat -n src/lib/utils/routePrompts.tsRepository: appwrite/website
Length of output: 1910
🏁 Script executed:
Repository: appwrite/website
Length of output: 575
🏁 Script executed:
Repository: appwrite/website
Length of output: 2167
Make
showCopyPagereactive to update on route changes.The
hasRoutePrompt()function reads from reactive state (page.route.id), but calling it as a plain function only captures the value once. Since DocsArticle.svelte persists across SvelteKit client-side navigation, the flag won't update when navigating between routes with and without prompt.md files, causing the copy button to display with stale visibility.Use
$derivedto ensure the flag updates whenever the route changes:Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents
Uh oh!
There was an error while loading. Please reload this page.
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.
Working just fine while navigating pages, should we still do it?
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.
@atharvadeosthale If you've tested navigation between routes with and without
prompt.mdfiles and the copy button visibility updates correctly, then you're good to go!The reactive change would only be necessary if the component instance persists across client-side navigations in SvelteKit. If
DocsArticle.sveltegets re-mounted on each route change (which appears to be the case based on your testing), thenhasRoutePrompt()gets called fresh each time and the plain constant works perfectly fine.Your real-world testing trumps theoretical concerns, so no need to change it if it's working correctly! 👍