Skip to content

Conversation

@benjiwheeler
Copy link
Contributor

@benjiwheeler benjiwheeler commented Sep 20, 2019

Proposed Changes

  • removes shouldNotModifyCloudData function and replaces it with prop canModifyCloudData (with opposite boolean value)
  • Sets prop defaults so that code which renders GUI (such as www's embed view) can safely omit most props, and trust GUI to still render as expected

@benjiwheeler benjiwheeler added this to the September 2019 milestone Sep 20, 2019
@benjiwheeler benjiwheeler self-assigned this Sep 20, 2019
@benjiwheeler benjiwheeler assigned kchadha and rschamp and unassigned benjiwheeler and kchadha Oct 18, 2019
@benjiwheeler benjiwheeler changed the title set defaults to play nicely with embed view set cloud-manager-hoc defaults Oct 18, 2019
Copy link
Contributor

@rschamp rschamp left a comment

Choose a reason for hiding this comment

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

I think adding CloudManager.defaultProps is a good idea. However I think we should leave canSave as .isRequired, since previously we had decided to try to keep as many things as required as possible, unless they are explicitly not required. The strictness helps things from being overlooked as props change.

@benjiwheeler
Copy link
Contributor Author

I think adding CloudManager.defaultProps is a good idea. However I think we should leave canSave as .isRequired, since previously we had decided to try to keep as many things as required as possible, unless they are explicitly not required. The strictness helps things from being overlooked as props change.

Take a look now. I added isRequired to each propType where it seems appropriate.

}

CloudManager.propTypes = {
canSave: PropTypes.bool.isRequired,
Copy link
Contributor

Choose a reason for hiding this comment

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

Also confused why this is a prop for CloudManager, even though you haven't touched that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know what you mean about having touched that. For why canSave is a prop here, see my comment above, at #5198 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

By "you haven't touched that", I was just acknowledging that this line isn't necessarily in scope for this PR since it's unchanged.

Copy link
Contributor

@rschamp rschamp left a comment

Choose a reason for hiding this comment

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

While I see why it is the way it is, the way canSave is used is counterintuitive to me. I think it would be more understandable if shouldNotModifyCloudData was a prop for CloudManagerHOC.

}

CloudManager.propTypes = {
canSave: PropTypes.bool.isRequired,
Copy link
Contributor

Choose a reason for hiding this comment

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

By "you haven't touched that", I was just acknowledging that this line isn't necessarily in scope for this PR since it's unchanged.

@benjiwheeler
Copy link
Contributor Author

benjiwheeler commented Jan 16, 2020

Next steps:

  • make shouldNotModifyCloudData into a prop, using ownProps
  • don't set default for canSave


CloudManager.propTypes = {
canSave: PropTypes.bool.isRequired,
canModifyCloudData: PropTypes.bool.isRequired,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

note that I switched the boolean value of shouldNotModifyCloudData canModifyCloudData.

There's potential confusion with hasCloudPermission, which in www is set to isScratcher; I have ideas for further simplification here, but I think we should take it one step at a time.

@benjiwheeler benjiwheeler changed the title set cloud-manager-hoc defaults simplify props of cloud-manager-hoc Jan 27, 2020
@rschamp rschamp assigned benjiwheeler and unassigned rschamp Jan 28, 2020
@benjiwheeler benjiwheeler merged commit 97885c7 into scratchfoundation:develop Jan 28, 2020
@benjiwheeler benjiwheeler deleted the block-cloud-on-embed branch January 28, 2020 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants