Skip to content

Init navigation controller outside of inject#52588

Merged
sanchitmalhotra126 merged 4 commits into
stagingfrom
sanchit/blockly-nav
Jul 6, 2023
Merged

Init navigation controller outside of inject#52588
sanchitmalhotra126 merged 4 commits into
stagingfrom
sanchit/blockly-nav

Conversation

@sanchitmalhotra126

Copy link
Copy Markdown
Contributor

Moves the navigationController.init() call to the to top level initializeBlocklyWrapper() function, and out of inject(). This allows inject() to be called multiple times, as previously calling inject() more than once would throw an error due to the navigation controller already being initialized.

Links

Slack discussion: https://codedotorg.slack.com/archives/C04TH8400AU/p1688066270812829

Testing story

Tested locally on a Google Blockly level (Dance Party)

@sanchitmalhotra126 sanchitmalhotra126 requested review from a team, breville and mikeharv July 3, 2023 20:59
Comment on lines +335 to +336
// Initialize plugin.
blocklyWrapper.navigationController.init();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe worth a comment that this means it's called once per page load, while inject can now potentially be called more than once?

Though I'm not actually sure whether folks arriving at this code in the future will wonder...

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.

Hmm yeah I can update this comment

@sanchitmalhotra126 sanchitmalhotra126 merged commit c033487 into staging Jul 6, 2023
@sanchitmalhotra126 sanchitmalhotra126 deleted the sanchit/blockly-nav branch July 6, 2023 18:37
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