Skip to content

feat: phone_ide v2 concept#1513

Merged
Sembauke merged 12 commits intofreeCodeCamp:mainfrom
Sembauke:feat/phone-ide-v2-concept
Jun 16, 2025
Merged

feat: phone_ide v2 concept#1513
Sembauke merged 12 commits intofreeCodeCamp:mainfrom
Sembauke:feat/phone-ide-v2-concept

Conversation

@Sembauke
Copy link
Member

@Sembauke Sembauke commented May 20, 2025

Checklist:

Do not merge before freeCodeCamp/PhoneIDE#76

@Sembauke Sembauke requested review from Nirajn2311 and Copilot June 2, 2025 13:34
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

A concept implementation for Phone IDE v2 that integrates a local phone_ide package and refactors the challenge editor lifecycle in the app.

  • Updated dependency to reference local phone_ide path.
  • Added Editor state management and initialization in ChallengeViewModel.
  • Refactored ChallengeView to consume the view model’s editor instance and updated file extension enum.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

File Description
mobile-app/pubspec.yaml Switched phone_ide dependency to a local path.
mobile-app/lib/ui/views/learn/challenge/challenge_viewmodel.dart Added _editor/editorLanguage state, initEditor and setters.
mobile-app/lib/ui/views/learn/challenge/challenge_view.dart Removed inline editor setup, now uses model.editor and loading spinner.
mobile-app/lib/enums/ext_type.dart Extended Ext enum cases with a value field for string mapping.
Comments suppressed due to low confidence (2)

mobile-app/lib/ui/views/learn/challenge/challenge_viewmodel.dart:238

  • [nitpick] Setter name 'setEditor' is redundant and non-idiomatic; consider using Dart's built-in setter syntax (e.g. 'set editor(Editor value)').
set setEditor(Editor editor) {

mobile-app/lib/ui/views/learn/challenge/challenge_viewmodel.dart:282

  • Setter 'setMounted' is used here but not defined in the class, leading to a compile error; define a set setMounted(bool value) setter or update this usage.
setMounted = true;

@Sembauke Sembauke marked this pull request as ready for review June 6, 2025 06:26
@Sembauke Sembauke requested a review from a team June 6, 2025 06:26
@Nirajn2311
Copy link
Member

Nirajn2311 commented Jun 11, 2025

The following error is thrown in the logs anytime any editor challenge is opened

Unhandled Exception: setState() called after dispose(): EditorState#c039f(lifecycle state: defunct, not mounted)
This error happens if you call setState() on a State object for a widget that no longer appears in the widget tree (e.g., whose parent widget no longer includes the widget in its build). This error can occur when code calls setState() from a timer or an animation callback.
The preferred solution is to cancel the timer or stop listening to the animation in the dispose() callback. Another solution is to check the "mounted" property of this object before calling setState() to ensure the object is still in the tree.
This error might indicate a memory leak if setState() is being called because another object is retaining a reference to this State object after it has been removed from the tree. To avoid memory leaks, consider breaking the reference to this object during dispose().
#0      State.setState.<anonymous closure> (package:flutter/src/w<…>

Copy link
Member

@Nirajn2311 Nirajn2311 left a comment

Choose a reason for hiding this comment

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

Resetting the code of a challenge removes the whole code completely across all regions

@Sembauke
Copy link
Member Author

The following error is thrown in the logs anytime any editor challenge is opened

This issue has been fixed. It was due the widget not being mounted while calling state. I've also updated how we dispose and listen to subscriptions in phoneIDE and here. Now we should be correctly handling state and subscriptions according to Flutter.

@Sembauke Sembauke merged commit 758fdcf into freeCodeCamp:main Jun 16, 2025
2 of 5 checks passed
@Sembauke Sembauke deleted the feat/phone-ide-v2-concept branch July 8, 2025 09:30
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