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

Datatables Persistent URL Tracking Fix #5330

Merged
merged 1 commit into from
Mar 29, 2024

Conversation

serpentblade
Copy link
Contributor

WHY

BEFORE - What was wrong? What was happening before this PR?

Under certain circumstances we want to render a table but not remember filtering. The flag for disabling table persistence is correct in that it doesn't trigger the redirect, however any changes made while that page is loaded still updates the localStorage value tracking filters so when a user returns to the regular persistence-enabled table it recreates the non-persistent state.

AFTER - What is happening after this PR?

When persistence is disabled it no longer updates the tracking variable.

HOW

How did you achieve that, in technical terms?

Update assures the the localStorage value code only runs when table persistence is enabled by wrapping the line in question in an if-block.

Is it a breaking change?

No.

How can we test the before & after?

Before: Disable table persistence on crud and monitor the application localStorage to see that a value is populated and updates as people use the rendered datatables.

After: localStorage is not updated/modified when persistence is disabled.

If the PR has changes in multiple repos please provide the command to checkout all branches, eg.:

git checkout "dev-branch-name" &&
cd vendor/backpack/crud && git checkout crud-branch-name &&
cd ../pro && git checkout pro-branch-name &&
cd ../../..

Under certain circumstances we want to render a table but not remember filtering. The flag for disabling table persistence is correct in that it doesn't trigger the redirect, however any changes made while that page is loaded still updates the localStorage value tracking filters so when a user returns to the regular persistence-enabled table it recreates the non-persistent state.

Update assures the the localStorage value code only runs when table persistence is enabled.
@welcome
Copy link

welcome bot commented Oct 2, 2023

BOOM! Your first PR with us, thank you so much! Someone will take a look at it shortly.

Please keep in mind that:

  • if this constitutes a breaking change, it might take quite a while for this to get merged; we try to emulate the Laravel release cycle as much as possible, so developers can upgrade both software once; this means a new big release every ~6 months;
  • even if it's a non-breaking change, it might take a few days/weeks for the PR to get merged; unless it's a no-brainer, we like to have some community feedback on new features, before we merge them; this leads to higher-quality code, in the end; we learnt this the hard way :-)
  • not all PRs get merged; sometimes we just have to hold out new features, to keep the packages lean; sometimes we don't include features that only apply to niche use cases;
  • we're not perfect; if you think we're wrong, call us out on it; but in a kind way :-) we all make mistakes, best we learn from them and build better software together;

Thank you!

--
Justin Case
The Backpack Robot

@tabacitu tabacitu added the Minor Bug A bug that happens only in a very niche or specific use case. label Oct 2, 2023
@tabacitu
Copy link
Member

tabacitu commented Oct 2, 2023

Hmm didn't know that. Thanks @serpentblade !

I'll let @pxpm test and merge this, he's in charge of our point releases.

Keep 'em coming.
Cheers!

@serpentblade
Copy link
Contributor Author

Any updates on getting this merged? Happy to discuss any concerns with this change. We'd love to have it fixed as we're currently overriding the entire blade template just for this small fix.

@pxpm
Copy link
Contributor

pxpm commented Nov 13, 2023

Hey @serpentblade, sorry for the delay I've been away last week. I will have a look at it during this week and get back to you 🙏

@pxpm pxpm merged commit f2878a6 into Laravel-Backpack:main Mar 29, 2024
1 of 2 checks passed
Copy link

welcome bot commented Mar 29, 2024

WHOOP-WHOOP! Congrats, your first PR on this repo has officialy been merged.

party

You should also receive an email inviting you to the Community Members team. That's where we, commited community members, debate new features and decide what's in the Backpack roadmap. Feel free to ignore the invitation if you're not interested :-)

If you want to help out the community in other ways, you can:

  • give your opinion on other Github Issues & PRs;
  • chat with others in the Gitter Chatroom (usually for quick help: How do I do X);
  • answer Backpack questions on Stackoverflow; you get points, people get help; you can subscribe to the backpack-for-laravel tag by adding a new filter; that will send you emails when new questions come up with our tag;

Again. Thank you for the PR. You are a wonderful person. Keep 'em coming :-)
Cheers!

--
Justin Case
The Backpack Robot

P.S. Help in the Backpack community is rewarded with free Backpack commercial licenses. It's the least we can do. If you feel you've helped the community with PRs, help & other stuff, please apply for free licenses and mention this PR. You scratch my back, I scratch your back. Thank you!

@pxpm
Copy link
Contributor

pxpm commented Mar 29, 2024

Totally missed this.
So sorry @serpentblade

Thanks for the PR 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Minor Bug A bug that happens only in a very niche or specific use case.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants