-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Only trigger changes for tables, cards and calendars if necessary (otherwise triggers auto-save) #20106
Conversation
🦋 Changeset detectedLatest commit: bea5cf2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
JFYI i have no prior experience with vue, so please let me know if i did something wrong :) |
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.
Great findings @leon-marzahn ❤️ LGTM 🚀
@paescuj Thanks ❤️ |
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.
At least for the table layout this does not seem to be a complete fix for the original issue.
firefox_bz2RUikqto.mp4
It might be related to the fact there weren't any presets beforehand, will investigate now! |
Interesting catch! This happens when you switch between collections and the |
Interesting will do some further testing then 😄 |
Cool ❤️ Here's the corresponding line: directus/app/src/composables/use-preset.ts Line 121 in c80f8ee
I wouldn't consider this as a blocker for this PR though & prefer to track this in a separate issue. |
@paescuj @br41nslug This is a very ugly solution, but something like this would work: function updatePreset(preset: Partial<Preset>, immediate?: boolean) {
localPreset.value = assign({}, localPreset.value, preset);
const hasChanged = Object.keys(preset.layout_query ?? {}).some(key => {
const query = (preset.layout_query ?? {})[key];
return !(Object.keys(query).length === 1 && 'page' in query);
});
if (!hasChanged) return;
immediate ? savePreset() : handleChanges();
} It just checks if the only change is the page in the |
This is why I prefer to create a separate issue for this, so we can discuss such things there 😄 |
I'll create one now |
@br41nslug LGTY? |
Why would we split this up? In my current tests the current solution does not completely solve the issue of "Don't create new presets for users when they have made no changes" 🤔 Independently of wheter there are already presets defined or not.
I disagree, in my opinion this is exactly what the issue is about "creating new presets without changes" 🤔 Although i could be wrong, we're missing actual "reproduction steps" on the issue, perhaps we should add some more detail to the original image to prevent this confusion. |
If we rephrase the issue to exactly this and add reproduction steps, would that work for you? The only issue is that this PR (and the other one) might not cover every example and we would have to keep it open until all cases are fixed |
We can never be sure to have covered all the possible cases but lets at least fix the 2 situations we know about. |
Okay, I will make changes to this issue and pr 👍🏻 |
Or lets organize that in the second PR you've created as that already looks like it includes the changes from this PR and the extra fix for switching collections. |
Oops, already deleted the other one 😅 |
@br41nslug I've updated the issue to include a reproduction and the latest changes are in this branch, how does it look? |
Seems the situation i ran into is indeed resolved, will have a look at the code and test other layouts tomorrow |
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.
The used fix for preset changes was a bit too effective 😬 It prevented saving layout changes and options altogether
Thanks @azrikahar! I was too busy with work 😅 |
No worries! The rest of the changes LGTM 😊 |
Scope
What's changed:
datesSet
after rendering, skipping the initial value (as the initial value is the same before and after rendering)Don't create/save preset on page changeReverted by bea5cf2, as per discussion in https://github.com/directus/directus/pull/20106/files#r1374908744Potential Risks / Drawbacks
Questions
Fixes #20105