Fix panic when no series found in a Discover page section. (#189)

* Fix panic when no series in Discover page section.

* Update `CHANGELOG`

* Bump version

* Update cargo dist
This commit is contained in:
Maarifa Maarifa
2024-02-21 10:42:10 +03:00
committed by GitHub
parent eb47539e6d
commit 9ed73e06a7
5 changed files with 33 additions and 23 deletions

View File

@@ -62,7 +62,7 @@ jobs:
# we specify bash to get pipefail; it guards against the `curl` command
# failing. otherwise `sh` won't catch that `curl` returned non-0
shell: bash
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.8.0/cargo-dist-installer.sh | sh"
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.10.0/cargo-dist-installer.sh | sh"
# sure would be cool if github gave us proper conditionals...
# so here's a doubly-nested ternary-via-truthiness to try to provide the best possible
# functionality based on whether this is a pull_request, and whether it's from a fork.
@@ -70,15 +70,15 @@ jobs:
# but also really annoying to build CI around when it needs secrets to work right.)
- id: plan
run: |
cargo dist ${{ !github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name) || (github.event.pull_request.head.repo.fork && 'plan' || 'host --steps=check') }} --output-format=json > dist-manifest.json
cargo dist ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || 'plan' }} --output-format=json > plan-dist-manifest.json
echo "cargo dist ran successfully"
cat dist-manifest.json
echo "manifest=$(jq -c "." dist-manifest.json)" >> "$GITHUB_OUTPUT"
cat plan-dist-manifest.json
echo "manifest=$(jq -c "." plan-dist-manifest.json)" >> "$GITHUB_OUTPUT"
- name: "Upload dist-manifest.json"
uses: actions/upload-artifact@v4
with:
name: artifacts
path: dist-manifest.json
name: artifacts-plan-dist-manifest
path: plan-dist-manifest.json
# Build and packages all the platform-specific things
build-local-artifacts:
@@ -118,8 +118,9 @@ jobs:
- name: Fetch local artifacts
uses: actions/download-artifact@v4
with:
name: artifacts
pattern: artifacts-*
path: target/distrib/
merge-multiple: true
- name: Install dependencies
run: |
${{ matrix.packages_install }}
@@ -144,7 +145,7 @@ jobs:
- name: "Upload artifacts"
uses: actions/upload-artifact@v4
with:
name: artifacts
name: artifacts-build-local-${{ join(matrix.targets, '_') }}
path: |
${{ steps.cargo-dist.outputs.paths }}
${{ env.BUILD_MANIFEST_NAME }}
@@ -163,13 +164,14 @@ jobs:
with:
submodules: recursive
- name: Install cargo-dist
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.8.0/cargo-dist-installer.sh | sh"
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.10.0/cargo-dist-installer.sh | sh"
# Get all the local artifacts for the global tasks to use (for e.g. checksums)
- name: Fetch local artifacts
uses: actions/download-artifact@v4
with:
name: artifacts
pattern: artifacts-*
path: target/distrib/
merge-multiple: true
- id: cargo-dist
shell: bash
run: |
@@ -185,7 +187,7 @@ jobs:
- name: "Upload artifacts"
uses: actions/upload-artifact@v4
with:
name: artifacts
name: artifacts-build-global
path: |
${{ steps.cargo-dist.outputs.paths }}
${{ env.BUILD_MANIFEST_NAME }}
@@ -207,13 +209,14 @@ jobs:
with:
submodules: recursive
- name: Install cargo-dist
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.8.0/cargo-dist-installer.sh | sh"
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.10.0/cargo-dist-installer.sh | sh"
# Fetch artifacts from scratch-storage
- name: Fetch artifacts
uses: actions/download-artifact@v4
with:
name: artifacts
pattern: artifacts-*
path: target/distrib/
merge-multiple: true
# This is a harmless no-op for Github Releases, hosting for that happens in "announce"
- id: host
shell: bash
@@ -225,7 +228,8 @@ jobs:
- name: "Upload dist-manifest.json"
uses: actions/upload-artifact@v4
with:
name: artifacts
# Overwrite the previous copy
name: artifacts-dist-manifest
path: dist-manifest.json
# Create a Github Release while uploading all files to it
@@ -247,8 +251,9 @@ jobs:
- name: "Download Github Artifacts"
uses: actions/download-artifact@v4
with:
name: artifacts
pattern: artifacts-*
path: artifacts
merge-multiple: true
- name: Cleanup
run: |
# Remove the granular manifests

View File

@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.5.1] - 2024-02-21
### Fixed
- Fix panic when no series found in a Discover page section.
## [0.5.0] - 2024-01-22
### Added

2
Cargo.lock generated
View File

@@ -3843,7 +3843,7 @@ dependencies = [
[[package]]
name = "series-troxide"
version = "0.5.0"
version = "0.5.1"
dependencies = [
"anyhow",
"bincode",

View File

@@ -7,7 +7,7 @@ categories = ["series", "TV", "gui", "tracker"]
keywords = ["series-tracker", "tv-shows", "tv-series", "entertainment", "gui"]
repository = "https://github.com/MaarifaMaarifa/series-troxide"
readme = "README.md"
version = "0.5.0"
version = "0.5.1"
edition = "2021"
[dependencies]
@@ -65,7 +65,7 @@ lto = "thin"
# Config for 'cargo dist'
[workspace.metadata.dist]
# The preferred cargo-dist version to use in CI (Cargo.toml SemVer syntax)
cargo-dist-version = "0.8.0"
cargo-dist-version = "0.10.0"
# CI backends to support
ci = ["github"]
# The installers to generate for each app

View File

@@ -1,5 +1,5 @@
use std::collections::HashMap;
use std::ops::RangeInclusive;
use std::ops::Range;
use std::sync::mpsc;
use iced::widget::{column, container, text, vertical_space, Column};
@@ -419,7 +419,7 @@ fn series_posters_viewer<'a>(
}
struct Posters<'a, T> {
index: HashMap<T, RangeInclusive<usize>>,
index: HashMap<T, Range<usize>>,
posters: Vec<SeriesPoster<'a>>,
series_page_sender: mpsc::Sender<SeriesMainInformation>,
@@ -443,7 +443,7 @@ where
message: fn(IndexedMessage<usize, SeriesPosterMessage>) -> Message,
) -> Command<Message> {
if self.posters.is_empty() {
let range = 0..=(series_infos.len() - 1);
let range = 0..(series_infos.len());
let (posters, poster_commands) = Self::generate_posters_and_commands_from_series_infos(
&range,
series_infos,
@@ -453,7 +453,7 @@ where
self.posters = posters;
Command::batch(poster_commands).map(message)
} else {
let range = self.posters.len()..=(self.posters.len() + series_infos.len() - 1);
let range = self.posters.len()..(self.posters.len() + series_infos.len());
let (mut posters, poster_commands) =
Self::generate_posters_and_commands_from_series_infos(
&range,
@@ -467,7 +467,7 @@ where
}
fn generate_posters_and_commands_from_series_infos(
range: &RangeInclusive<usize>,
range: &Range<usize>,
series_infos: Vec<&'a SeriesMainInformation>,
series_page_sender: mpsc::Sender<SeriesMainInformation>,
) -> (