Skip to content

Support multiple files when editing snippets

Denys Mishunov requested to merge 220785-snippet-editing-multi into master

What does this MR do?

In the course of supporting multiple files when working with Snippets, this MR updates snippet edit form to work properly with updated GraphQL endpoints that supply an array of files instead of a single file.

This MR is just the first step for the edit form and nothing should be changed visually in the form. Hence no screenshots are provided.

What are the main challenges of this MR?

The most challenging part was to identify what data to send to GraphQL endpoint for proper mutation. The core logic is located in !37079 (diffs). For historical reasons and to have a reference for when it is needed, here's the table of different scenarios:

New or unchanged file Changed content Changed file path Changed content & file path
Mutation payload example
{
action: 'create'
previousPath: ''
filePath: 'foo-bar.md'
content: 'Some content'
}
{
action: 'update'
previousPath: ''
filePath: 'foo-bar.md'
content: 'Updated content'
}
{
action: 'move'
previousPath: 'foo-bar.md'
filePath: 'new-foo-bar.js'
content: 'Some content'
}
{
action: 'move'
previousPath: 'foo-bar.md'
filePath: 'new-foo-bar.js'
content: 'Updated content'
}

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

References #220524 (closed) #220785 (closed) #229779 (closed)

Edited by Denys Mishunov

Merge request reports