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

Bug fix and various enhancement #11

Merged
merged 26 commits into from
Jul 17, 2022
Merged

Bug fix and various enhancement #11

merged 26 commits into from
Jul 17, 2022

Conversation

j4w3ny
Copy link
Contributor

@j4w3ny j4w3ny commented Jun 18, 2022

@j4w3ny j4w3ny force-pushed the prototype branch 3 times, most recently from 1e62645 to 042b1b7 Compare June 18, 2022 08:57
app/src/App.tsx Outdated Show resolved Hide resolved
app/craco.config.js Outdated Show resolved Hide resolved
app/src/App.tsx Outdated Show resolved Hide resolved
app/src/App.tsx Outdated Show resolved Hide resolved
core/src/base/mod.rs Outdated Show resolved Hide resolved
Previous code would calculating hashes when there's any update from working dir, move it into tarui state management to avoid duplicating hash calculating.

File watcher now shared the same score state from tarui, reduced some unnecessary file/hash operations.
@kirillt kirillt mentioned this pull request Jul 2, 2022
This was referenced Jul 2, 2022
@kirillt
Copy link
Member

kirillt commented Jul 5, 2022

Failure during .link creation:

[kirill@lenovo shelf]$ rm -rf /tmp/debug ; mkdir -p /tmp/debug ; RUST_BACKTRACE=1 ark-shelf-desktop2 -p /tmp/debug
[core/src/main.rs:137] &scores = []
[core/src/command/mod.rs:68] &path_list = []
6215903662141738005.link
[core/src/command/mod.rs:64] &item = DirEntry("/tmp/debug/6215903662141738005.link")
[core/src/command/mod.rs:68] &path_list = [
    "6215903662141738005.link",
]
thread 'tokio-runtime-worker' panicked at 'called `Result::unwrap()` on an `Err` value: Error { kind: Uncategorized, message: "creation time is not available for the filesystem" }', core/src/base/link.rs:157:63
stack backtrace:
   0: rust_begin_unwind
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/panicking.rs:143:14
   2: core::result::unwrap_failed
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/result.rs:1785:5
   3: <ark_shelf_desktop::base::link::Link as core::convert::From<std::path::PathBuf>>::from
   4: ark_shelf_desktop::command::read_link
   5: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
   6: tokio::runtime::task::core::CoreStage<T>::poll
   7: tokio::runtime::task::harness::poll_future
   8: tokio::runtime::task::harness::Harness<T,S>::poll
   9: std::thread::local::LocalKey<T>::with
  10: tokio::runtime::thread_pool::worker::Context::run_task
  11: tokio::runtime::thread_pool::worker::Context::run
  12: tokio::macros::scoped_tls::ScopedKey<T>::set
  13: tokio::runtime::thread_pool::worker::run
  14: <tokio::runtime::blocking::task::BlockingTask<T> as core::future::future::Future>::poll
  15: tokio::runtime::task::harness::Harness<T,S>::poll
  16: tokio::runtime::blocking::pool::Inner::run

The invalid .link file is created in this case, which cannot be loaded neither from desktop version nor from mobile:

[kirill@lenovo tmp]$ RUST_BACKTRACE=1 ark-shelf-desktop2 -p /tmp/debug/
thread 'main' panicked at 'index out of bounds: the len is 1 but the index is 1', core/src/base/mod.rs:62:48
stack backtrace:
   0: rust_begin_unwind
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/panicking.rs:143:14
   2: core::panicking::panic_bounds_check
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/panicking.rs:84:5
   3: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once
   4: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
   5: ark_shelf_desktop::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

@kirillt
Copy link
Member

kirillt commented Jul 5, 2022

This PR introduces created_time JSON field, which must be implemented in mobile version too in order to open files created in desktop version.

Update: this idea of storing created timestamp is good, but we will implement it later, after we move Rust code into arklib and wire it into ARK Shelf mobile app. Also see https://github.com/arK-Builders/arK-Navigator/issues/269 and https://github.com/arK-Builders/arK-Navigator/issues/269 for inspiration.

@kirillt
Copy link
Member

kirillt commented Jul 5, 2022

ARK-Builders/ARK-Navigator#5 is not finished

@@ -28,7 +28,7 @@ async fn create_link(
Ok(val) => val,
Err(e) => return Err(e.to_string()),
};
let link = Link::new(title, desc, url);
let mut link = Link::new(title, desc, url);
Copy link
Member

Choose a reason for hiding this comment

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

Redundant mutability

@j4w3ny j4w3ny merged commit 092f6b8 into main Jul 17, 2022
@kirillt kirillt deleted the prototype branch August 20, 2022 19:15
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.

2 participants