-
-
Notifications
You must be signed in to change notification settings - Fork 15
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
[Bug]: Not properly working with VersionStrategy::DIFF #10
Comments
This is an issue in Laravel versionable. It will be fixed soon. |
@mutschler Have you tried to use |
yeah i've tried that and it works. However i didn't plan to keep full snapshots on the data but only save the changes. Full Snapshots provide too much overhead. Since i've already red upstream that there are plans for dropping However i've spent some time looking into it before and it's actually relatively easy to fix. Actually revertWithoutSaving already does most of the things needed by looping through all changes up to the current one, so you'll get the keys you need to have when comparing. I'm gonna check if is still got my solution lying around somewhere if you're interested ;) From what i've still got in my head: load the initial version, apply all changes up to the current one -1 resulting in a full entry with all fields then get rid of all keys which are not in the current record. |
I will check. @overtrue maybe you should read this. |
@mutschler I am open for a pr or any code block that helps. |
i've pushed the code which seemed to work for me here overtrue/laravel-versionable#62 not really sure if the if/else part for loading the As mentioned before it's more or less the same thing |
@mutschler I think its fixed and working for you? I am closing for now, feel free to open if you still have issues. |
What happened?
If you use
VersionStrategy::DIFF
(default) only changed values are stored, so the revision view breaks when you update a filed that wasn't saved in the version beforeHow to reproduce the bug
VersionStrategy::DIFF
as strategytitle
,content
fieldstitle
=> only new title will be savedcontent
=> only new content will be savedcontent
is not present on the previous versionPackage Version
0.0.6
PHP Version
8.2
Laravel Version
11
Which operating systems does with happen with?
Linux
Notes
This isn't directly related to this plugin i guess but to the Diff class you wrote for the upstream package...
From my understanding: In DIFF Mode you can't directly compare one version to the previous one. You'll have to either load the first version, apply every diff and compare the result to the current one OR go back till you have all keys which where changed in the current version and show them from there
The text was updated successfully, but these errors were encountered: