Skip to content
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

back button + popups #2707

Merged
merged 2 commits into from
Oct 7, 2024
Merged

back button + popups #2707

merged 2 commits into from
Oct 7, 2024

Conversation

pablonyx
Copy link
Contributor

@pablonyx pablonyx commented Oct 7, 2024

Description

How Has This Been Tested?

[Describe the tests you ran to verify your changes]

Accepted Risk

[Any know risks or failure modes to point out to reviewers]

Related Issue(s)

[If applicable, link to the issue(s) this PR addresses]

Checklist:

  • All of the automated tests pass
  • All PR comments are addressed and marked resolved
  • If there are migrations, they have been rebased to latest main
  • If there are new dependencies, they are added to the requirements
  • If there are new environment variables, they are added to all of the deployment methods
  • If there are new APIs that don't require auth, they are added to PUBLIC_ENDPOINT_SPECS
  • Docker images build and basic functionalities work
  • Author has done a final read through of the PR right before merge

Copy link

vercel bot commented Oct 7, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
internal-search ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 7, 2024 7:51pm

@pablonyx pablonyx changed the title øback button + popups back button + popups Oct 7, 2024
@pablonyx pablonyx marked this pull request as ready for review October 7, 2024 19:35
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR introduces improvements to navigation and user feedback across various admin pages in the Danswer application. Key changes include:

  • Added back button functionality and modified popup behavior in the EmbeddingFormPage component
  • Implemented a new usePopupFromQuery hook for handling popup messages based on URL query parameters
  • Updated URL handling in FormContext and EmbeddingContext to improve navigation and back button functionality
  • Enhanced the indexing status page with a success popup for connector creation
  • Improved the search settings page with more detailed information display and a success popup

Potential areas of concern:

  • Console.log statements in EmbeddingContext and FormContext should be removed before merging
  • The new PopupFromQuery component might benefit from additional error handling and cleanup of URL parameters

8 file(s) reviewed, 7 comment(s)
Edit PR Review Bot Settings

updatedSearchParams.set("step", formStep.toString());
const newUrl = `${pathname}?${updatedSearchParams.toString()}`;
router.push(newUrl);

console.log("existingStep", existingStep);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Remove this console.log before merging to production

Comment on lines +65 to +69
if (!existingStep) {
router.replace(newUrl);
} else if (newUrl !== pathname) {
router.push(newUrl);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: This logic may cause unexpected behavior if the URL contains other query parameters


if (!existingStep) {
router.replace(newUrl);
console.log("replacing", newUrl);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Remove this console.log statement before merging to production


export const usePopupFromQuery = (messages: PopupMessages) => {
const router = useRouter();
const { popup, setPopup } = usePopup();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Consider destructuring setPopup only, as popup is not used in this hook

const router = useRouter();
const { popup, setPopup } = usePopup();

useEffect(() => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: The effect has missing dependencies. Add router, messages, and setPopup to the dependency array

for (const key in messages) {
if (messageValue === key) {
const popupMessage = messages[key];
console.log("popupMessage", popupMessage);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Remove console.log statement before merging to production

}
}, []);

return { popup };
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: The popup value is not used within the hook, consider not returning it

@pablonyx pablonyx added this pull request to the merge queue Oct 7, 2024
Merged via the queue into main with commit 150dcc2 Oct 7, 2024
7 checks passed
@pablonyx pablonyx deleted the backstreet branch October 17, 2024 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants