-
Notifications
You must be signed in to change notification settings - Fork 174
Implement create/clone/edit functionality for collection form #3644
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -85,6 +85,9 @@ function CollectionsFormPage({ | |
| } else if (loading) { | ||
| content = <>{/* TODO - Handle UI for loading state */}</>; | ||
| } else if (initialData) { | ||
| if (pageAction.type === 'clone') { | ||
| initialData.name += ' (COPY)'; | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is that although control flow prevents A question for thought (not blocker to merge) is whether there is an alternative control flow which would allow TypeScript to report such a mutation as a problem? Maybe a prior question is does TypeScript report a problem with current code if
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Commenting here because I noticed while reading code, but it is hard to comment on the line above: {getAxiosErrorMessage(error)}Less important now that you implemented permission checks, but allows any other generic logic.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought about making the I think I generally just assume that the data structures I use are immutable even if it isn't strictly enforced. (And sometimes take advantage over it not being so strict like in this case.) I wonder how Formik would handle things if we passed it immutable initial data? A quick look at their source shows they are running state through a reducer so chances are it would work out fine. I can experiment with this in a follow up. |
||
| content = ( | ||
| <CollectionForm | ||
| hasWriteAccessForCollections={hasWriteAccessForCollections} | ||
|
|
||
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.
As a follow up, you might compare to policies which
goBackafter save. For a specific example, there was some consensus among the team that when people have the task to create several collections, it might be convenient and seem intuitive to go back to table page which has Create collection button.We can brainstorm pro and con on a call, if you like.
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.
Sequence of titles in browser history is another way to compare pro and con of push versus pop.
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.
Sure we can discuss this next week. I compared the behavior of policies and integrations when deciding on this vs
goBackand went with push since the way the form works seems a little more similar to integrations. In both collections and integrations, the individual view pages are more of a read-only version of the form, while policies has its own dedicated UI for viewing a single policy. I felt like thegoBackfunctionality was a little unclear when going from an editable collection form to a read-only collection form with the changes applied.