-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
DataViews Quick Edit: Add Post Card to the quick edit panel #64365
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
@@ -27,55 +27,47 @@ import { | |||
} from '../../store/constants'; | |||
import { unlock } from '../../lock-unlock'; | |||
|
|||
export default function PostCardPanel( { actions } ) { | |||
export default function PostCardPanel( { postType, postId, actions } ) { |
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 main change in this component is that it no longer relies on the "editor" store context to be able to work. It's actually a component that probably don't belong in "editor" package anymore but more something for "core-data" or "core-dataviews" or something like that.
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.
Can you expand a bit on this? Not that it is important for this PR.
In my mind, core-data is about data fetching and dataviews is about building lists & forms and it's WordPress agnostic. A PostCardPanel
(title summary for a post) smells to an utility that fits in an editor package: a package anyone would use to build editors. Isn't that the purpose of the editor package? Why would you think it no longer fits here?
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.
"Editor" is a package that is for rendering an "editor" for a given post type. Its main requirement is that most of its component should be wrapped by EditorProvider
which initializes the store and everything.
On the other hand: Fields, Actions, PostCard component these are things that define "fields", and "actions" (the whole editor/src/dataviews
folder) and a utility component for a given post type, post Id regardless of whether they are used in an editor or not. They are about defining "entities" properly so that's why in my mind they are closer to core-data
than editor
. I would be ok with a dedicated package as well on top of core-data
Size Change: +43 B (0%) Total Size: 1.77 MB
ℹ️ View Unchanged
|
// When the post is first created, the top level wp_pattern_sync_status is not set so get meta value instead. | ||
const currentSyncStatus = | ||
getEditedPostAttribute( 'meta' ) | ||
?.wp_pattern_sync_status === 'unsynced' | ||
_record?.meta?.wp_pattern_sync_status === 'unsynced' |
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.
getEditedPostAttribute
does a lot more things than just returning the att. With the changes here, the postcard would only be updated after saving the changes while before it was updated as they changes happen (change title in panel). Is that correct? Is it the reason for these changes?
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.
I've noticed this:
Gravacao.do.ecra.2024-08-08.as.11.33.16.mov
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.
If we show the edited entity in the editor (title, post card), shouldn't we do the same in dataviews if we aim to provide a seamless editing experience?
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.
getEditedPostAttribute does a lot more things than just returning the att. With the changes here, the postcard would only be updated after saving the changes while before it was updated as they changes happen (change title in panel). Is that correct? Is it the reason for these changes?
the record
is computed using getEditedEntityRecord
(notice the "edited" in the name) so it's also going to bring the "unsaved edits". The reason for this change is that I don't want to rely on the "editor" store. I can call "core" directly and we're already doing so using getEditedEntityRecord
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.
If we show the edited entity in the editor (title, post card), shouldn't we do the same in dataviews if we aim to provide a seamless editing experience?
Yes, this seems like a separate bug IMO. But it also relates to the "update" button. I guess we should remove the "update" button in this case and just rely on the global save button.
@jameskoster These are both good remarks but I think should be addressed separately. |
Can we land this? |
I just ran into one issue reported at #64389 (comment) (notice how the PostCard remains "Clearing floats"): Gravacao.do.ecra.2024-08-09.as.11.34.23.mov |
@oandregal I can reproduce, I'll look into it. |
Co-authored-by: youknowriad <[email protected]> Co-authored-by: oandregal <[email protected]> Co-authored-by: jameskoster <[email protected]>
Related #55101
What?
As shown in the mockups in the issue, we need to render the "post card" and the "actions" for the selected item in the quick edit panel.
This PR starts by rendering the "Post Card" when a single item is selected.
Testing Instructions
1- Enable the quick edit experiment
2- Go the pages table dataviews
3- Select a single item
4- Notice that you have the title of the page and the icon rendered at the top of the "quick edit" panel.
Notes