Skip to content
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

Fix Sliver crash in Demo Website (Resolves #2329) #2461

Merged
merged 1 commit into from
Dec 20, 2024

Conversation

angelosilvestre
Copy link
Collaborator

Fix Sliver crash in Demo Website. Resolves #2329

The original ticket mentions a different issue, which I could not reproduce. With the latest main, the editor is crashing immediately with the following exception:

══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
The following _TypeError was thrown building DocumentMouseInteractor(dependencies: [MediaQuery],
state: _DocumentMouseInteractorState#72a71):
TypeError: Instance of '_RenderSliverHybridStack': type '_RenderSliverHybridStack' is not a subtype
of type 'RenderBox'

The relevant error-causing widget was:
  DocumentMouseInteractor
  DocumentMouseInteractor:file:///Users/angelosilvestre/dev/super_editor/super_editor/lib/src/default_editor/super_editor.dart:865:16

The issue is that, when the editor has an ancestor Scrollable, it doesn't add it's own CustomScrollView to the widget tree. In the demo website, there is an ancestor SingleChildScrollView, which doesn't work for scrolling the editor anymore, since now SuperEditor is a sliver.

This PR removes the SingleChildScrollView and places a CustomScrollView directly above SuperEditor.

We cannot just remove the SingleChildScrollView because the editor will then try to scroll the page's scrollable, which will also cause a crash, because the page's scrollable isn't a CustomScrollView.

Maybe we need a way to signal to the editor that it should ignore the ancestor scrollable.

Copy link
Contributor

@matthew-carroll matthew-carroll left a comment

Choose a reason for hiding this comment

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

LGTM

@matthew-carroll matthew-carroll merged commit e98f6b2 into main Dec 20, 2024
9 of 14 checks passed
@matthew-carroll matthew-carroll deleted the 2329_fix-website branch December 20, 2024 01:08
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.

[BUG] - web demo is down
2 participants