-
-
Notifications
You must be signed in to change notification settings - Fork 127
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
perf: don't create thumbnails when auto-saving #1175
Open
QubaB
wants to merge
9
commits into
saber-notes:main
Choose a base branch
from
QubaB:AutosaveDoesNotCreateThumbnail
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…mall lag. At the end of noete editting is tested state and if thumbnail is not created it is called.
…mbnail) file not note file itself. Because Autosave now saves only note itself, but does not create thumbnail. Thumbnail can be created on editor exit but note itself is not updated. This cause update of thumbnail at any case.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1175 +/- ##
==========================================
- Coverage 37.50% 36.96% -0.54%
==========================================
Files 108 108
Lines 8554 8576 +22
==========================================
- Hits 3208 3170 -38
- Misses 5346 5406 +60 ☔ View full report in Codecov by Sentry. |
adil192
reviewed
Mar 18, 2024
adil192
changed the title
feat: Autosave only saves note. Does not create thumbnail
perf: don't create thumbnails when auto-saving
Mar 18, 2024
Drawing something and clicking save gives me this error: Launching lib/main.dart on Linux in debug mode...
Building Linux application...
Syncing files to device Linux... 205ms
Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).
A Dart VM Service on Linux is available at: http://127.0.0.1:41135/rKfNL5wM7bs=/
The Flutter DevTools debugger and profiler on Linux is available at:
http://127.0.0.1:9101?uri=http://127.0.0.1:41135/rKfNL5wM7bs=/
flutter: dynamic_color: Accent color detected.
flutter: INFO: FileSyncer: Adding /24-03-18 Untitled.sbn2 to upload queue
══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY
╞═══════════════════════════════════════════════════════════
The following assertion was thrown building Directionality(textDirection: ltr):
'package:flutter/src/widgets/framework.dart': Failed assertion: line 2115 pos 12:
'_elements.contains(element)': is not true.
Either the assertion indicates an error in the framework itself, or we should
provide substantially
more information in this error message to help you determine and fix the underlying
cause.
In either case, please report this assertion by filing a bug on GitHub:
https://github.com/flutter/flutter/issues/new?template=2_bug.yml
The relevant error-causing widget was:
Directionality
Directionality:file:///home/ahann/.pub-cache/hosted/pub.dev/screenshot-2.1.0/lib/
screenshot.dart:189:20
When the exception was thrown, this was the stack:
#2 _InactiveElements.remove
(package:flutter/src/widgets/framework.dart:2115:12)
#3 Element._retakeInactiveElement
(package:flutter/src/widgets/framework.dart:4266:30)
... Normal element mounting (7 frames)
#10 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#11 Element.updateChild (package:flutter/src/widgets/framework.dart:3846:18)
#12 RenderObjectToWidgetElement._rebuild
(package:flutter/src/widgets/adapter.dart:143:16)
#13 RenderObjectToWidgetElement.mount
(package:flutter/src/widgets/adapter.dart:112:5)
#14 RenderObjectToWidgetAdapter.attachToRenderTree.<anonymous closure>
(package:flutter/src/widgets/adapter.dart:61:18)
#15 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2844:19)
#16 RenderObjectToWidgetAdapter.attachToRenderTree
(package:flutter/src/widgets/adapter.dart:60:13)
#17 ScreenshotController.widgetToUiImage
(package:screenshot/screenshot.dart:192:16)
#18 ScreenshotController.captureFromWidget
(package:screenshot/screenshot.dart:106:28)
#19 EditorState.createThumbnailPreview
(package:saber/pages/editor/editor.dart:890:43)
#20 EditorState.saveToFile (package:saber/pages/editor/editor.dart:875:32)
<asynchronous suspension>
(elided 2 frames from class _AssertionError)
═══════════════════════════════════════════════════════════════════════════════════
═════════════════
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Looking up a deactivated widget's ancestor is unsafe.
At this point the state of the widget's element tree is no longer stable.
To safely refer to a widget's ancestor in its dispose() method, save a reference to the ancestor by calling dependOnInheritedWidgetOfExactType() in the widget's didChangeDependencies() method.
#0 Element._debugCheckStateIsActiveForAncestorLookup.<anonymous closure> (package:flutter/src/widgets/framework.dart:4738:9)
#1 Element._debugCheckStateIsActiveForAncestorLookup (package:flutter/src/widgets/framework.dart:4752:6)
#2 Element.dependOnInheritedWidgetOfExactType (package:flutter/src/widgets/framework.dart:4771:12)
#3 ModalRoute.of (package:flutter/src/widgets/routes.dart:1046:47)
#4 GoRouterState.of (package:go_router/src/state.dart:119:51)
#5 _RecentPageState.findRecentlyAccessedNotes (package:saber/pages/home/recent_notes.dart:90:38)
#6 _RecentPageState.fileWriteListener (package:saber/pages/home/recent_notes.dart:80:5)
#7 _RootZone.runUnaryGuarded (dart:async/zone.dart:1594:10)
#8 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)
#9 _DelayedData.perform (dart:async/stream_impl.dart:515:14)
#10 _PendingEvents.handleNext (dart:async/stream_impl.dart:620:11)
#11 _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:591:7)
#12 _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
#13 _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Looking up a deactivated widget's ancestor is unsafe.
At this point the state of the widget's element tree is no longer stable.
To safely refer to a widget's ancestor in its dispose() method, save a reference to the ancestor by calling dependOnInheritedWidgetOfExactType() in the widget's didChangeDependencies() method.
#0 Element._debugCheckStateIsActiveForAncestorLookup.<anonymous closure> (package:flutter/src/widgets/framework.dart:4738:9)
#1 Element._debugCheckStateIsActiveForAncestorLookup (package:flutter/src/widgets/framework.dart:4752:6)
#2 Element.dependOnInheritedWidgetOfExactType (package:flutter/src/widgets/framework.dart:4771:12)
#3 ModalRoute.of (package:flutter/src/widgets/routes.dart:1046:47)
#4 GoRouterState.of (package:go_router/src/state.dart:119:51)
#5 _RecentPageState.findRecentlyAccessedNotes (package:saber/pages/home/recent_notes.dart:90:38)
#6 _RecentPageState.fileWriteListener (package:saber/pages/home/recent_notes.dart:80:5)
#7 _RootZone.runUnaryGuarded (dart:async/zone.dart:1594:10)
#8 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)
#9 _DelayedData.perform (dart:async/stream_impl.dart:515:14)
#10 _PendingEvents.handleNext (dart:async/stream_impl.dart:620:11)
#11 _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:591:7)
#12 _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
#13 _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)
Another exception was thrown: Duplicate GlobalKey detected in widget tree.
flutter: INFO: FileSyncer: Adding /24-03-18 Untitled.sbn2.p to upload queue
flutter: dynamic_color: Accent color detected.
Performing hot reload...
Reloaded 1 of 3368 libraries in 4,884ms (compile: 53 ms, reload: 4478 ms,
reassemble: 194 ms).
Lost connection to device. |
I will try to look at this problem. |
QubaB
commented
Mar 19, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When note is autosaved, there is no need to create a thumbnail which causes small lag during hang writing.
New SavingState.savedNeedThumbnailUpdate state is implemented indicating that note is saved but thumbnail is not created.
On editor exit is checked this state and thumbnail is created.
PreviewCard fileWriteListener is listening to write to thumbnail file to be able to detect change of thumbnail itself.
Closes #1164 (or at least lag is smaller)