Skip to content
This repository was archived by the owner on May 17, 2021. It is now read-only.

Conversation

lrlna
Copy link
Contributor

@lrlna lrlna commented Nov 26, 2019

Description

Adds a + ADD FIELD button with an input field in export-fields modal.

Motivation and Context

ev3eSx4mK0

+ ADD FIELD button scrolls over to the bottom of the table and focuses on the input field to be edited. The field is only saved on enter, which is indicated by the text on the side of the table. When the input field is submitted, fields props are updated and the component is refreshed. That particular field is saved even after the user goes to OUTPUT and comes back to FIELDS.

Open Questions

Currently once I hit enter to save the currently edited field, I am not able to prevent the modal from scrolling up a bit. This happens because the element is rerendering, so I understand that the state just changed and the focus was lost. Anyone have an idea as to how to get the focus back to the previous state, aka the input field at the bottom after the rerender?

Types of changes

  • Minor (non-breaking change which adds functionality)

@lrlna lrlna requested a review from imlucas November 26, 2019 14:08
Copy link
Contributor

@imlucas imlucas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently once I hit enter to save the currently edited field, I am not able to prevent the modal from scrolling up a bit. This happens because the element is rerendering, so I understand that the state just changed and the focus was lost. Anyone have an idea as to how to get the focus back to the previous state, aka the input field at the bottom after the rerender?

You could track in state if any fields have been customized and if so focus to the input field on re-render?

@lrlna
Copy link
Contributor Author

lrlna commented Nov 27, 2019

@imlucas, oh my god, ofc that makes sense. Thankssss!

@lrlna lrlna merged commit e87cfa7 into master Nov 27, 2019
@lrlna lrlna deleted the edit-export-fields branch November 27, 2019 11:02
@imlucas imlucas mentioned this pull request Dec 4, 2019
imlucas added a commit that referenced this pull request Dec 4, 2019
Cutting master so all of your export improvements from the past few days can be upstreamed into compass asap with @mongodb-js/compass-import-export@^4.2.0.

The import type casting stuff in #18 is complex enough that I don't want it blocking so it will go as 5.0.0. We can keep this 4.x-releases branch ref around just in case casting performance is a real dud and we want to take another stab at it.

Now that this release has been published, a PR to mongodb-js/compass 📦 @mongodb-js/compass-import-export@^4.2.0 has changelog:

UX improvements: display doc count, do not display line numbers #20
COMPASS-3961: allow adding missing fields #19
COMPASS-3851: ability to add fields when exporting collection #17
imlucas added a commit to mongodb-js/compass that referenced this pull request Dec 6, 2019
Now that this release has been published, a PR to mongodb-js/compass 📦 `@mongodb-js/compass-import-export@^4.2.0` has changelog:

- UX improvements: display doc count, do not display line numbers mongodb-js/compass-import-export#20
- Closes COMPASS-3961: allow adding missing fields mongodb-js/compass-import-export#19
- Closes COMPASS-3851: ability to add fields when exporting collection mongodb-js/compass-import-export#17
imlucas added a commit to mongodb-js/compass that referenced this pull request Dec 6, 2019
)

Now that this release has been published, a PR to mongodb-js/compass 📦 `@mongodb-js/compass-import-export@^4.2.0` has changelog:

- UX improvements: display doc count, do not display line numbers mongodb-js/compass-import-export#20
- Closes COMPASS-3961: allow adding missing fields mongodb-js/compass-import-export#19
- Closes COMPASS-3851: ability to add fields when exporting collection mongodb-js/compass-import-export#17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants