Skip to content

JavalabEditor refactor: move editor state into Redux#46970

Merged
sanchitmalhotra126 merged 23 commits intostagingfrom
ben/javalab-editor-refactor-redux
Aug 8, 2022
Merged

JavalabEditor refactor: move editor state into Redux#46970
sanchitmalhotra126 merged 23 commits intostagingfrom
ben/javalab-editor-refactor-redux

Conversation

@bencodeorg
Copy link
Copy Markdown
Contributor

This is the "things get worse before they get better" PR -- moves most of the state needed to break up JavalabEditor into Redux.

I think I'm not going to merge this PR, because I'd have to fix a bunch of JavalabEditor tests that are going to be updated when this new Redux state is moved into other components (the idea here is to split JavalabEditor up, and I think that a lot of this state will move out of JavalabEditor eventually). I (or someone else) can branch off of this PR to implement some of the splitting up proposed here and here.

I'd appreciate feedback on whether the direction here seems reasonable though!

Links

Testing story

I tested manually that I was able to perform Javalab editor actions (rename/create/delete files, navigate between tabs, import from the backpack) in three different scenarios -- 1) a new project via /projects/javalab/new, 2) an existing level via /allthethings, and 3) editing start sources as a levelbuilder. There should be no new functionality added here, so I did not add any new tests.

@bencodeorg bencodeorg changed the title JavalabEditor refactor: move JavalabEditor refactor: move editor state into Redux Jun 23, 2022
@bencodeorg bencodeorg requested a review from a team June 23, 2022 21:03
Comment thread apps/src/javalab/javalabRedux.js Outdated

export const getTabKey = index => `file-${index}`;

const fileMetadataForEditor = (sources, isEditingStartSources) => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

could this logic of converting sources -> fileMetadata be done in some helper function elsewhere (that is called before setting fileMetadata in redux)? Generally I think we want to keep redux free of complex logic.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok makes sense -- I stumbled across this file yesterday, might be a good place for it:

https://github.com/code-dot-org/code-dot-org/blob/staging/apps/src/javalab/JavalabFileHelper.js

Copy link
Copy Markdown
Contributor

@sanchitmalhotra126 sanchitmalhotra126 left a comment

Choose a reason for hiding this comment

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

LGTM! Like we discussed I think these changes will be really helpful in moving more stuff out of this file down the road.

…factor/file-errors-redux

Move file error message into redux
…factor/split-dialog-header

Move Javalab Editor header and dialogs into their own components
…factor/commitdialog

Move compile status state management into CommitDialog
@sanchitmalhotra126 sanchitmalhotra126 merged commit 8ce9687 into staging Aug 8, 2022
@sanchitmalhotra126 sanchitmalhotra126 deleted the ben/javalab-editor-refactor-redux branch August 8, 2022 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants