Skip to content

Fix: Infinite loop when listen to FocusNode in read-only mode #2488

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 3, 2025

Conversation

chaosue
Copy link
Contributor

@chaosue chaosue commented Feb 25, 2025

Description

If the property readOnly is set to true, typically in the read mode of contents, the UI tread may be stuck by endless loop when the route push back to the page with quill.

The direct cause comes from the _handleFocusChanged listener, the focusNode will keep losing focus and requesting focus again instantly.

The root cause hasn't been digged out, removing the unnecessary listeners in readOnly mode can resolve the issue at the moment.

Type of Change

  • Feature: New functionality without breaking existing features.
  • 🛠️ Bug fix: Resolves an issue without altering current behavior.
  • 🧹 Refactor: Code reorganization, no behavior change.
  • Breaking: Alters existing functionality and requires updates.
  • 🧪 Tests: New or modified tests
  • 📝 Documentation: Updates or additions to documentation.
  • 🗑️ Chore: Routine tasks, or maintenance.
  • Build configuration change: Build/configuration changes.

@chaosue chaosue changed the title fix unpredicatble endless loop of '_handleFocusChanged' in the hase of page route changingwhen editor is set to readonly fix unpredictable endless loop of '_handleFocusChanged' in the hase of page route changingwhen editor is set to readonly Feb 25, 2025
@CatHood0

This comment was marked as resolved.

@CatHood0 CatHood0 changed the title fix unpredictable endless loop of '_handleFocusChanged' in the hase of page route changingwhen editor is set to readonly [Fix]: Infinite loop when listen to FocusNode in read-only mode. Feb 26, 2025
@CatHood0 CatHood0 changed the title [Fix]: Infinite loop when listen to FocusNode in read-only mode. [Fix]: Infinite loop when listen to FocusNode in read-only mode Feb 26, 2025
@CatHood0 CatHood0 changed the title [Fix]: Infinite loop when listen to FocusNode in read-only mode Fix: Infinite loop when listen to FocusNode in read-only mode Feb 26, 2025
@CatHood0 CatHood0 self-requested a review February 28, 2025 17:38
@CatHood0 CatHood0 added bug Something isn't working major Significant impact on the user experience or performance. This issue should be addressed in the next awaiting response Pending additional information or feedback from the issue creator labels Feb 28, 2025
@CatHood0 CatHood0 removed their request for review February 28, 2025 17:56
… of page route changing when editor is set to readonly.
@chaosue chaosue force-pushed the master branch 2 times, most recently from 9d71e32 to 5ee4901 Compare March 3, 2025 03:16
@chaosue

This comment was marked as resolved.

@CatHood0 CatHood0 removed the awaiting response Pending additional information or feedback from the issue creator label Mar 3, 2025
Copy link
Collaborator

@CatHood0 CatHood0 left a comment

Choose a reason for hiding this comment

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

LGTM.

@CatHood0 CatHood0 merged commit 7262be7 into singerdmx:master Mar 3, 2025
8 checks passed
CatHood0 pushed a commit to CatHood0/flutter-quill that referenced this pull request Mar 12, 2025
… of page route changing when editor is set to readonly. (singerdmx#2488)

Co-authored-by: chaos <chaos@veigit.com>
@EchoEllet
Copy link
Collaborator

EchoEllet commented Apr 22, 2025

It's looks like this fix caused another issue #2518 and we need to handle this regression. We either merge #2529 or revert this fix.

wangjinshan pushed a commit to wangjinshan/flutter-quill that referenced this pull request Apr 29, 2025
* master: (83 commits)
  Add copyWith methods to DefaultStyles, HorizontalSpacing, and VerticalSpacing (singerdmx#2550)
  docs: update migration guide to relfect singerdmx#2529
  chore(release): prepare to publish 11.4.0
  feat: allow to override link validation check, and accept mailto and other links by default (singerdmx#2525)
  chore(release): prepare to publish 11.3.0
  Fix selection in readOnly mode, Add magnifier via RawMagnifier widget (singerdmx#2529)
  Clarify platform support of QuillEditorConfig.onKeyPressed (singerdmx#2542)
  chore(release): prepare to publish 11.2.0
  feat: cache for toPlainText in Document to avoid unnecessary text computing (singerdmx#2482)
  chore(example): update deps
  chore(release): prepare to publish 11.1.2
  fix: QuillEditor doesn't respect the system keyboard brightness by default on iOS (singerdmx#2522)
  chore(release): prepare to publish flutter_quill_test
  chore(release): prepare to publish 11.1.1
  Chore: general improvements in flutter_quill_tests API (singerdmx#2512)
  Explicitly schedule frame on secondary click. (singerdmx#2507)
  chore(release): prepare to publish 11.1.0
  fix: unpredictable endless loop of '_handleFocusChanged' in the phase of page route changing when editor is set to readonly. (singerdmx#2488)
  feat: Enable BoxDecoration for DefaultTextBlockStyle of header Attribute (singerdmx#2438)
  Expose Rule type so that Document.setCustomRules can be used (singerdmx#2484)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working major Significant impact on the user experience or performance. This issue should be addressed in the next
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants