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

Reload FeaturePanel & EditDialog when done #685

Merged
merged 3 commits into from
Oct 26, 2024

Conversation

kudlav
Copy link
Contributor

@kudlav kudlav commented Oct 15, 2024

Description

Redraw FeaturePanel & EditDialog when changes are saved and the success info dialog is closed.

The previous code did nothing because the redirect URL was the same as the current URL:

router.replace(successInfo.redirect); // only useRouter reloads the panel client-side

Example links

  1. Edit feature
  2. Save, Done
  3. The feature panel is redrawn and the edit dialog is usable for another edit

Screenshots

Checklist

  • dark mode / light mode
  • mobile / desktop
  • server-side-rendering (SSR)

Copy link

vercel bot commented Oct 15, 2024

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

Name Status Preview Updated (UTC)
osmapp ✅ Ready (Inspect) Visit Preview Oct 26, 2024 9:21pm

@@ -10,7 +10,8 @@ export const useGetOnClose = () => {
return () => {
close();
if (successInfo?.redirect) {
router.replace(successInfo.redirect); // only useRouter reloads the panel client-side
// Reloads the panel client-side
router.replace('/').then(() => router.replace(successInfo?.redirect));
Copy link
Owner

@zbycz zbycz Oct 17, 2024

Choose a reason for hiding this comment

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

Could you try redirecting user to url like /node/2432753840?version=7?

I think we may be able to get the version from the osmApi. And it wouldn't run an unneccesary request to / in between, thus making it quicker.

Do not implement any logic about the version param, i think it would just tell browser to refresh it.

If this doesn't work somehow, I am ok with your solution as it is much better than current 😅

btw, i will be vacationing for next few weeks, mostly offline. 🏖️😃 @Dlurak can help you merge this if he has time

Copy link
Contributor Author

@kudlav kudlav Oct 19, 2024

Choose a reason for hiding this comment

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

Tried router.replace with:

  • /node/597644745 to /node/597644745/4 ❌ no refresh
  • /node/597644745 to /node/597644745?v=4 ❌ no refresh

So it seems that redirecting to / is necessary.

I tried router.replace even with unstable_skipClientCache: true option.

Copy link
Owner

Choose a reason for hiding this comment

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

Thanks for the check. And thanks @Dlurak for merging. 👌

@Dlurak Dlurak enabled auto-merge (squash) October 26, 2024 21:19
@Dlurak Dlurak merged commit 2de5a47 into zbycz:master Oct 26, 2024
2 checks passed
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.

3 participants