Commit Graph

87 Commits

Author SHA1 Message Date
Tienson Qin
01479ef9da enhance(perf): insert and delete blocks (#9142)
* enhance(perf): improve performance for both insert and delete

* fix: remember cursor pos before executing the body in a transaction

Otherwise, the edit-block and position could be changed

* fix: disable delete-concat when there's no child or right sibling

---------

Co-authored-by: Gabriel Horner <97210743+logseq-cldwalker@users.noreply.github.com>
Co-authored-by: Gabriel Horner <gabriel@logseq.com>
2023-05-09 17:24:09 +08:00
Tienson Qin
f8178bcd9b fix: lazy loading shakes (#9139)
* fix: lazy loading shakes

Also, enable lazy loading on mobile

* enhance(perf): lazy load deadlines and scheduled

* enhance(perf): clean up queries when components are invisible

For queries including both ::ref and ::block.
2023-04-24 18:29:19 +08:00
Tienson Qin
b17c4ea37e enhance: show custom title instead of live query for custom queries (#9026)
* enhance(ui): replace live query with custom title if exists

also moved query related components to frontend.components.query

* fix: simplify query components' state
2023-04-12 11:12:05 +08:00
Tienson Qin
db6fc6b7ee feat: simple query builder (#8774)
Simple query builder

---------

Co-authored-by: Gabriel Horner <gabriel@logseq.com>
Co-authored-by: charlie <xyhp915@qq.com>
2023-03-21 14:27:00 +08:00
Tienson Qin
0e365508be fix: wrong usage of :frontend.db.react/refs
Previously, `[:frontend.db.react/refs id]` is used for three places:
1. get-page-referenced-blocks
2. get-block-referenced-blocks
3. get-block-references-count

The cached query atom will be shared between those three functions,
the problem is that both queries in `get-page-referenced-blocks` and
`get-block-referenced-blocks` return data of different formats, which
can result in crashes in some situations (e.g. PR #8423).

This commit removed `get-block-references-count` and use
`model/pull-block` and `(count (:block/_refs block))` instead.

We also need to make sure the `id` in `[:frontend.db.react/refs id]`
will be different for `get-page-referenced-blocks` and
`get-block-referenced-blocks`. We can probably get rid of
`get-page-referenced-blocks` once we refactored both linked references
and filters for pages.
2023-02-21 23:49:25 +08:00
Tienson Qin
3e71b1d6f3 fix: db/entity with interger id is not nil with non-exist block (#7723)
fix: returns nil for db/entity if the entity doesn't exist

Co-authored-by: Junyi Du <junyidu.cn@gmail.com>
2022-12-16 00:21:42 +08:00
Junyi Du
5ee8707469 chore: merge function util/with-time and util/with-time-number 2022-12-15 20:37:17 +08:00
Gabriel Horner
2ce6dfad41 Use catch :default for default error handling in cljs
This is considered normal practice for cljs. See
https://clojure.atlassian.net/browse/CLJS-661 for when it was introduced
and background on it
2022-09-23 02:00:55 +08:00
Tienson Qin
814e26468a perf: don't refresh ::refs if the editing is inside current page 2022-08-22 17:08:53 +08:00
Tienson Qin
3d5825330e wip: fix wrong refs and filters 2022-08-22 17:08:53 +08:00
Tienson Qin
1fefe92433 fix: query refresh button 2022-08-15 21:58:46 +08:00
Tienson Qin
e5532bfe7e fix: move blocks up/down can still affect path refs 2022-08-15 21:58:46 +08:00
Tienson Qin
08ba4348b9 fix: lint warnings 2022-08-15 21:58:46 +08:00
Tienson Qin
21603f9d1d fix: distinct blocks when sort by left 2022-08-15 21:58:46 +08:00
Tienson Qin
6e87aa9386 perf: don't refresh all paginated blocks queries 2022-08-15 21:58:46 +08:00
Tienson Qin
6bbbccd942 fix: a react component might have multiple reactive queries 2022-08-15 21:58:46 +08:00
Tienson Qin
fd5f3b4f60 perf: refs reactive query 2022-08-15 21:58:46 +08:00
Tienson Qin
d6abc839ec fix: performance degradation for 0.8.0 2022-08-15 21:58:46 +08:00
Tienson Qin
a1ca6820df Fix: broken linked references (#6105)
* enhance: clicking the refresh button if a query is slow

* fix: skip running slow queries if there's no need to refresh

* fix: linked reference filtering does not work on TASK items

close #1669

* fix: each block should have its own page as a reference when query page references

* fix: references

* fix: non consecutive blocks in query result and filtered linked references

* simplify filters logic

* fix: ref numbers

* Save both :block/refs and :block/path-refs for different usage

* fix: block refs

* enhance: move scheduled and deadlines to its own ns

* linked references performance tweaks

* mouse hover filters icon to expand the collapsed linked refs

* perf: react/refresh! once instead twice

* enhance: compute flashcards every hour instead of every 5s

* feat: macros as blocks

* feat: flashcards list

* fix: refed pages count

* fix: can't select in linked references

* fix: block editing on linked refs

* perf: editing in linked references

* enhance: update srs cards number when clicking flashcards

* Add a test for the case fixed in #6100

* Address feedbacks from Gabriel

* fix: Block Ref Indicator is missing from the references-blocks class

close #5375

* fix: referenced pages

* fix: page refs

* fix: Using filters pushed the title property to the second block

close #5845

Co-authored-by: Gabriel Horner <gabriel@logseq.com>
2022-08-04 13:03:12 +08:00
Tienson Qin
56b2405762 fix: Long pages got cut off when toggle on/off a nested bullet
close #5422
2022-07-20 13:56:04 +08:00
Tienson Qin
b7025b9ce4 fix: undo/redo paginations 2022-07-20 13:56:04 +08:00
Tienson Qin
d40c0d8926 fix: WIP broken undo/redo for long page 2022-07-20 13:56:04 +08:00
Gabriel Horner
5bce219ca4 Remove unused db-type being passed to start-conn
Also removed other unused db fns
2022-05-26 18:04:45 -04:00
Gabriel Horner
5b0d5fb8b5 Decouple graph-parser util from app util usage
For tiny util heavily used fns like safe-re-find and uuid-string?,
decouple graph-parser from so much of the app
2022-05-13 16:17:44 -04:00
Tienson Qin
9042aa47c5 fix: block wrong indentation in queries 2022-05-12 07:39:37 +08:00
Tienson Qin
278f2ff1f9 fix: lint warnings 2022-05-12 07:39:37 +08:00
Tienson Qin
d1c6d4ce88 fix: indent/outdent blocks not updated 2022-05-12 07:39:37 +08:00
Tienson Qin
2614310ea8 Lazy load blocks in references and queries 2022-05-12 07:39:37 +08:00
Gabriel Horner
85bd1fecb2 Move first batch of util fns to graph-parser.util
Still need to fix external.roam
2022-05-04 12:02:36 -04:00
Tienson Qin
904eff6d9d Core outliner operations refactoring (#4880)
* Add outliner nested transact!

Copied the code mostly from https://github.com/logseq/logseq/pull/4671
by zhiyuan

* refactor: insert-blocks

* fix: insert-blocks

* fix: move cursor to the last block when inserting

* fix: replace the current block when inserting and its content is empty

* keep only :insert-blocks

* expose only :delete-blocks

* Use existing implementations for move-nodes-up-down and

indent/outdent.

* fix editing state not updated immediately

* fix editing status

* fix: avoid recursive copy

* fix: inserting blocks after an empty block

* Implement move-blocks with insert-blocks

* fix: block left

* Implement move-blocks-up-down with move-blocks

* fix: paste text

* Implement indent-outdent-blocks with move-blocks

* fix: indent/outdent

* feat: multiple blocks drag && drop

* fix: indent/outdent blocks

* fix: drag drop

* Port unit tests for outliner.core

* enhance: open collapsed parent when indenting blocks

* refactor: block selection

* fix: indent/outdent blocks with different levels

* Add instrument on invalid outliner structure

* fix: can't write a block if the page has any outdated blocks

* fix: editing status for empty page

* fix: multiple drag & drop

* fix: drag & drop disallows moving from parents to its child

* fix: public property

* fix: can't delete first empty block

* Remove unused code

* fix: e2e tests

A workaround is to not select/highlight the block when pressing esc if it has
fenced code.

* remove unused code

* Add batch transaction test

* fix: update :block/page when dragging targets' children to another page

* Add more tests

* Simplify extract

* Replace db/get-conn with db/get-db

* Simplify extracting blocks from ast

* Code cleanup

* Code cleanup

* Add outliner core fuzzy tests

* Remove unused code

* fix: cursor not jump to the upper block when pressing Enter in the beginning

* fix: Enter in the beginning of a non-empty block

* Fix lint warnings

* Add editor random e2e tests

* Fix typo

* enhance: move some fns and add some comments

* enhance(outliner): add page-block? util

* fix: increase td width to prevent content overflow

Signed-off-by: Yue Yang <g1enyy0ung@gmail.com>

* First pass at file tests for file-sync

Each action usually passes by 5th try

* Fix two incorrect calls caught by tests

* More test improvements

- Easier auth setup
- subdirectory is configurable
- list graphs api also exercised

* Address cleanup from #3839

- Remove unused translation key
- Delete or TODO commented code
- Capitalize notifications to users

* fix quick capture template not working

* enhance(sync): add logout

* enhance: add logout i18n

* fix(plugin): sometimes plugin settings of gui not work when entry from app settings

* enable show-brackets? toggle for orgmode [[file:./pages/demo.org][demo]]

* fix(sync): fix unfinishable sync loop

* feature: logseq protocol; refactor persistGraph

* fix: deeplink support

* fix: broadcast persist graph on opening new graph with logseq protocol

* feat: logseq protocol open action for page-name and uuid

* fix: logseq protocol graph param validation

* ux: copy logseq URL of block

* enhance: remove the redundant 'open' from logseq protocol (v0.1)

* ux: page dropdown button for copy page URL

* chore: logseq protocol comments

* don't create new contents file when changing format

Logseq now creates a new contents file when users try to toggle the
preferred format, which causes file duplications error.

* fix pasting in src block not working on iOS

close https://github.com/logseq/logseq/issues/4914

* fix playing video goes into editing mode on iOS

* fix copy to clipboard failure on iOS

* add Podfile item

* fix mobile toolbar order not persisting after restart

* test(e2e): add test for backspace and cursor pos (#4896)

* test(e2e): add test for backspace and cursor pos
* fix(test): refine, fix wrong helper

* fix(ui): warn about illegal git commit interval

* enhance(editor): allow global git cmd shortcut

* style(settings): line-space of general/journals

* enhance(editor): accept enter in dummy block

Fix #4931

* fix editing state not updated immediately

* fix: can't write a block if the page has any outdated blocks

TODO: clean outdated blocks

* fix: editing status for empty page

* Random tree for outliner core tests

* Add pre assertions and fn docs based on Zhiyuan's suggestions

* Made some changes based on Gabriel's suggestions

* fix: tests

* fix: save current block before moving

* Updated the timeout to 100ms based on llcc's suggestion

https://github.com/logseq/logseq/pull/4880#discussion_r851966301

* api-insert-new-block! supports replace-empty-target?

* fix: replace all :reuse-last-block? usage

Co-authored-by: rcmerci <rcmerci@gmail.com>
Co-authored-by: Yue Yang <g1enyy0ung@gmail.com>
Co-authored-by: Gabriel Horner <gabriel@logseq.com>
Co-authored-by: llcc <lzhes43@gmail.com>
Co-authored-by: charlie <xyhp915@qq.com>
Co-authored-by: Junyi Du <junyidu.cn@gmail.com>
Co-authored-by: Andelf <andelf@gmail.com>
2022-04-19 11:14:38 +08:00
Tienson Qin
c46c68cd14 improve performance for drag && drop 2022-04-02 21:40:28 +08:00
Tienson Qin
e848dbf9f8 enhance: run custom queries immediately if editing in a query component 2022-04-02 21:40:28 +08:00
Tienson Qin
06b15bdfc3 use :block/_refs instead of reactive block-refs-count query 2022-04-02 21:40:28 +08:00
Tienson Qin
7a095571f6 remove unused code 2022-04-02 21:40:28 +08:00
Tienson Qin
ee897c244b Refactor page loading 2022-04-02 21:40:28 +08:00
Tienson Qin
e959e257b7 fix: db transactions expected sequential collection while #{} is not 2022-03-16 14:52:32 +08:00
Tienson Qin
2e340ca1c6 fix: srs cards
close #4521
2022-03-10 18:21:34 +08:00
Tienson Qin
30785c6a87 fix: recent pages
related to #4322
2022-02-24 23:09:36 +08:00
Tienson Qin
bd1e1346f4 fix: lint warnings 2022-02-22 16:52:59 +08:00
Tienson Qin
8046ccd4d6 enhancement: only run custom queries when not typing 2022-02-22 16:52:59 +08:00
Tienson Qin
db07341ebe perf: disable new-db cache for custom queries
related to #4285
2022-02-19 14:40:49 +08:00
Tienson Qin
8c9f2dc266 fix: UI is not refreshed when editing empty pages 2022-02-19 14:27:44 +08:00
Tienson Qin
a609024b19 chore: code style 2022-02-18 18:54:38 +08:00
Tienson Qin
2d622be63a perf: reduce pull-many queries for get-page-blocks (#4253)
perf: reduce pull-many queries for get-page-blocks
2022-02-18 18:50:18 +08:00
Tienson Qin
ee9b52248e Performance improvement: incremental queries (#4002)
Incremental queries
2022-02-17 20:26:03 +08:00
Tienson Qin
5d17315561 Clean code 2022-02-08 15:50:56 +08:00
Gabriel Horner
b3ee61b1ca Remove more unused fns 2022-01-27 14:11:59 -05:00
Gabriel Horner
7497d8b396 Lint a good chunk of src/main/frontend
Left some TODOs to discuss with others and others for me to finish
2022-01-11 17:34:54 -05:00
Junyi Du
7505b0dde6 fix: introduce more page-name sanity 2022-01-10 13:29:40 +08:00
Tienson Qin
b46055328e enhance(perf): edit the page itself should be fast no matter how
many refs it has
2021-11-10 14:59:08 +08:00