Skip to content

Commit

Permalink
Merge branch 'rrousselGit:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
yang-lile authored Nov 13, 2023
2 parents 3cee744 + 717e89b commit 527b04f
Show file tree
Hide file tree
Showing 47 changed files with 437 additions and 145 deletions.
14 changes: 7 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ There are a few ways to contribute to the Riverpod ecosystem:
on bug fixes instead.

**It is highly encouraged to make an issue before creating your PR**
This is especially crutial for larger work.
This is especially crucial for larger work.
You do not need to spend a lot of time making that issue. The important is:

- Mention that you want to contribute
Expand All @@ -44,14 +44,14 @@ Riverpod's documentation uses [Docusaurus](https://docusaurus.io/fr/docs).
This framework is responsible for various features of the website. Check out
its documentation, as it may have the answer to your questions.

Documentations are written in "mdx", which is a combination of Markdown and JSX.
Documentation is written in "mdx", which is a combination of Markdown and JSX.
If you are familiar with Markdown, this should be reasonably easy to pick up.
Feel free to look at existing pages to see how they work.

### Installing the website locally

The docs uses [node](https://nodejs.org/fr) and [yarn](https://yarnpkg.com/).
You will need to install install both and run:
You will need to install both and run:

```sh
yarn install
Expand All @@ -71,20 +71,20 @@ Riverpod supports multiple languages.
To add new languages, it is recommended to follow the [i18n](https://docusaurus.io/fr/docs/i18n/introduction)
documentation of Docusaurus.

The english documentation is hosted in [`/website/docs`](https://github.com/rrousselGit/riverpod/tree/master/website/docs).
The English documentation is hosted in [`/website/docs`](https://github.com/rrousselGit/riverpod/tree/master/website/docs).
Translations are hosted in [`/website/i18n`](https://github.com/rrousselGit/riverpod/tree/master/website/i18n).

### Working on packages

### Updating english docs
### Updating English docs

English docs are the source of truth for Riverpod docs. As such, translations
may get "out of date" for a period of time.
To make it obvious for users that a translated page may be out of date, Riverpod's
website supports showing a warning banner at the top of the translation pages.

To support in a maintainable way, when editing english docs in a way that requires
translations to be updated, the english's "version number" needs to be bumped.
To support in a maintainable way, when editing English docs in a way that requires
translations to be updated, the English's "version number" needs to be bumped.
**This does not need to be done when fixing typos**

To bump the version number of a page, you should either add or update
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter_riverpod/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Unreleased patch
## 2.4.6 - 2023-11-13

- Exceptions in asynchronous providers are now correctly received
by `ProviderObserver.providerDidFail`.
Expand Down
4 changes: 2 additions & 2 deletions packages/flutter_riverpod/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: flutter_riverpod
description: >
A simple way to access state from anywhere in your application
while robust and testable.
version: 2.4.5
version: 2.4.6
homepage: https://riverpod.dev
repository: https://github.com/rrousselGit/riverpod
issue_tracker: https://github.com/rrousselGit/riverpod/issues
Expand All @@ -18,7 +18,7 @@ dependencies:
flutter:
sdk: flutter
meta: ^1.4.0
riverpod: 2.4.5
riverpod: 2.4.6
state_notifier: ">=0.7.2 <2.0.0"

dev_dependencies:
Expand Down
3 changes: 2 additions & 1 deletion packages/hooks_riverpod/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
## Unreleased patch
## 2.4.6 - 2023-11-13

- Exceptions in asynchronous providers are now correctly received
by `ProviderObserver.providerDidFail`.
- Fix exception when a `ProviderScope` is rebuilt with a different `key`.

## 2.4.5 - 2023-10-28

Expand Down
6 changes: 3 additions & 3 deletions packages/hooks_riverpod/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: hooks_riverpod
description: >
A simple way to access state from anywhere in your application
while robust and testable.
version: 2.4.5
version: 2.4.6
homepage: https://riverpod.dev
repository: https://github.com/rrousselGit/riverpod
issue_tracker: https://github.com/rrousselGit/riverpod/issues
Expand All @@ -18,8 +18,8 @@ dependencies:
flutter:
sdk: flutter
flutter_hooks: '>=0.18.0 <0.21.0'
flutter_riverpod: 2.4.5
riverpod: 2.4.5
flutter_riverpod: 2.4.6
riverpod: 2.4.6
state_notifier: ">=0.7.2 <2.0.0"

dev_dependencies:
Expand Down
2 changes: 1 addition & 1 deletion packages/riverpod/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Unreleased patch
## 2.4.6 - 2023-11-13

- Exceptions in asynchronous providers are now correctly received
by `ProviderObserver.providerDidFail`.
Expand Down
2 changes: 1 addition & 1 deletion packages/riverpod/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: riverpod
description: >
A simple way to access state from anywhere in your application while robust
and testable.
version: 2.4.5
version: 2.4.6
homepage: https://riverpod.dev
repository: https://github.com/rrousselGit/riverpod
issue_tracker: https://github.com/rrousselGit/riverpod/issues
Expand Down
1 change: 0 additions & 1 deletion packages/riverpod_analyzer_utils_tests/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: riverpod_analyzer_utils_tests
description: A sample command-line application.
publish_to: none
version: 0.0.1

environment:
sdk: ">=2.18.0 <3.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ void testSource(
required String source,
Map<String, String> files = const {},
bool runGenerator = false,
Timeout? timeout,
}) {
final testId = _testNumber++;
test(
description,
timeout: timeout,
() async {
// Giving a unique name to the package to avoid the analyzer cache
// messing up tests.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import 'package:test/test.dart';
import 'analyzer_test_utils.dart';

void main() {
testSource('Decode ProviderContainer creations', source: '''
testSource('Decode ProviderContainer creations',
timeout: const Timeout.factor(2), source: '''
import 'package:riverpod/riverpod.dart';
final provider = Provider((ref) => 0);
Expand Down
4 changes: 4 additions & 0 deletions packages/riverpod_annotation/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.3.1 - 2023-11-13

- `riverpod` upgraded to `2.4.6`

## 2.3.0 - 2023-10-28

- Exported internal `FamilyOverride` API, for use in generated code.
Expand Down
4 changes: 2 additions & 2 deletions packages/riverpod_annotation/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: riverpod_annotation
description: A package exposing annotations for riverpod_generator
version: 2.3.0
version: 2.3.1
repository: https://github.com/rrousselGit/riverpod
issue_tracker: https://github.com/rrousselGit/riverpod/issues
funding:
Expand All @@ -11,7 +11,7 @@ environment:

dependencies:
meta: ^1.7.0
riverpod: ^2.4.5
riverpod: ^2.4.6

dev_dependencies:
test: ^1.21.0
2 changes: 1 addition & 1 deletion packages/riverpod_generator/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Unreleased patch
## 2.3.6 - 2023-11-13

- Fix typos and internal changes

Expand Down
6 changes: 3 additions & 3 deletions packages/riverpod_generator/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: riverpod_generator
description: A code generator for Riverpod. This both simplifies the syntax empowers it, such as allowing stateful hot-reload.
version: 2.3.5
version: 2.3.6
repository: https://github.com/rrousselGit/riverpod
issue_tracker: https://github.com/rrousselGit/riverpod/issues
funding:
Expand All @@ -18,11 +18,11 @@ dependencies:
meta: ^1.7.0
path: ^1.8.0
riverpod_analyzer_utils: ^0.4.3
riverpod_annotation: ^2.3.0
riverpod_annotation: ^2.3.1
source_gen: ^1.2.0

dev_dependencies:
build_runner: ^2.1.7
build_verify: ^3.0.0
riverpod: ^2.4.5
riverpod: ^2.4.6
test: ^1.21.0
2 changes: 1 addition & 1 deletion packages/riverpod_lint/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Unreleased patch
## 2.3.4 - 2023-11-13

- Updated `scoped_providers_should_specify_dependencies` to ignore instances of using pumpWidget in tests (thanks to [lockieRichter](https://github.com/lockieRichter))

Expand Down
4 changes: 2 additions & 2 deletions packages/riverpod_lint/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: riverpod_lint
description: Riverpod_lint is a developer tool for users of Riverpod, designed to help stop common issues and simplify repetitive tasks.
version: 2.3.3
version: 2.3.4
homepage: https://riverpod.dev
repository: https://github.com/rrousselGit/river_pod
issue_tracker: https://github.com/rrousselGit/riverpod/issues
Expand All @@ -17,7 +17,7 @@ dependencies:
custom_lint_builder: ^0.5.2
meta: ^1.7.0
path: ^1.8.1
riverpod: ^2.4.5
riverpod: ^2.4.6
riverpod_analyzer_utils: ^0.4.3
source_span: ^1.8.0
yaml: ^3.1.1
Expand Down
6 changes: 6 additions & 0 deletions website/docs/concepts/combining_providers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ import {
When,
} from "../../src/components/CodeSnippet";

:::caution
The content of this page may be outdated.
It will be updated in the future, but for now you may want to refer to the content
in the top of the sidebar instead (introduction/essentials/case-studies/...)
:::

Make sure to read <Link documentID="concepts/providers"/> first.
In this guide, we will learn about combining provider states.

Expand Down
7 changes: 5 additions & 2 deletions website/docs/concepts/modifiers/auto_dispose.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
title: .autoDispose
---

import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
:::caution
The content of this page may be outdated.
It will be updated in the future, but for now you may want to refer to the content
in the top of the sidebar instead (introduction/essentials/case-studies/...)
:::

A common use case is to destroy the state of a provider
when it is no-longer used.
Expand Down
6 changes: 6 additions & 0 deletions website/docs/concepts/modifiers/family.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
import { Link } from "../../../src/components/Link";

:::caution
The content of this page may be outdated.
It will be updated in the future, but for now you may want to refer to the content
in the top of the sidebar instead (introduction/essentials/case-studies/...)
:::

Before reading this, consider reading about <Link documentID="concepts/providers"/> and <Link documentID="concepts/reading"/>.
In this part, we will talk in detail about the `.family` provider modifier.

Expand Down
6 changes: 6 additions & 0 deletions website/docs/concepts/provider_lifecycles.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ import CodeBlock from "@theme/CodeBlock";
import onDispose from "./lifecycle_on_dispose";
import { trimSnippet, When, AutoSnippet } from "../../src/components/CodeSnippet";

:::caution
The content of this page may be outdated.
It will be updated in the future, but for now you may want to refer to the content
in the top of the sidebar instead (introduction/essentials/case-studies/...)
:::

## When does my Provider get created and disposed?

The states that all different types of providers can go through are the same:
Expand Down
6 changes: 6 additions & 0 deletions website/docs/concepts/provider_observer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ import CodeBlock from "@theme/CodeBlock";
import logger from "!!raw-loader!/docs/concepts/provider_observer_logger.dart";
import { trimSnippet } from "../../src/components/CodeSnippet";

:::caution
The content of this page may be outdated.
It will be updated in the future, but for now you may want to refer to the content
in the top of the sidebar instead (introduction/essentials/case-studies/...)
:::

[ProviderObserver] listens to the changes of a ProviderContainer.

To use it, extend the class ProviderObserver and override the method you want to use.
Expand Down
8 changes: 6 additions & 2 deletions website/docs/concepts/providers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ title: Providers
import creatingProvider from "./providers/creating_a_provider";
import declaringManyProviders from "./providers/declaring_many_providers";
import {
trimSnippet,
AutoSnippet,
When,
} from "../../src/components/CodeSnippet";
import { Link } from "../../src/components/Link";

:::caution
The content of this page may be outdated.
It will be updated in the future, but for now you may want to refer to the content
in the top of the sidebar instead (introduction/essentials/case-studies/...)
:::

Now that we have installed [Riverpod], let's talk about "providers".

Providers are the most important part of a [Riverpod] application.
Expand Down
8 changes: 6 additions & 2 deletions website/docs/concepts/reading.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
title: Reading a Provider
---

import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
import CodeBlock from "@theme/CodeBlock";
import counter from "./reading/counter";
import consumerWidget from "./reading/consumer_widget";
Expand All @@ -25,6 +23,12 @@ import {
} from "../../src/components/CodeSnippet";
import { Link } from "../../src/components/Link";

:::caution
The content of this page may be outdated.
It will be updated in the future, but for now you may want to refer to the content
in the top of the sidebar instead (introduction/essentials/case-studies/...)
:::

Before reading this guide, make sure to <Link documentID="concepts/providers"/> first.

In this guide, we will see how to consume a provider.
Expand Down
8 changes: 6 additions & 2 deletions website/docs/concepts/scopes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
title: Scopes
---

import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
import CodeBlock from "@theme/CodeBlock";
import asyncInitialization from "!!raw-loader!/docs/concepts/async_initialization.dart";
import dialogScope from "!!raw-loader!/docs/concepts/dialog_scope.dart";
Expand All @@ -12,6 +10,12 @@ import subtreeScope from "!!raw-loader!/docs/concepts/subtree_scope.dart";
import { trimSnippet } from "../../src/components/CodeSnippet";
import { Link } from "../../src/components/Link";

:::caution
The content of this page may be outdated.
It will be updated in the future, but for now you may want to refer to the content
in the top of the sidebar instead (introduction/essentials/case-studies/...)
:::

Scoping in Riverpod is a very powerful feature, but like all powerful features, it should be used wisely and intentionally.

A few of the things that scoping enables are:
Expand Down
6 changes: 6 additions & 0 deletions website/docs/concepts/why_immutability.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ import {
When,
} from "../../src/components/CodeSnippet";

:::caution
The content of this page may be outdated.
It will be updated in the future, but for now you may want to refer to the content
in the top of the sidebar instead (introduction/essentials/case-studies/...)
:::

## What is Immutability?

Immutability is when all fields of an `Object` are final or late final.
Expand Down
10 changes: 0 additions & 10 deletions website/docs/cookbooks/refresh.mdx

This file was deleted.

6 changes: 6 additions & 0 deletions website/docs/cookbooks/search_as_we_type.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
title: Search as we type
---

:::caution
The content of this page may be outdated.
It will be updated in the future, but for now you may want to refer to the content
in the top of the sidebar instead (introduction/essentials/case-studies/...)
:::

A real world example could be to use `FutureProvider` to implement a searchbar.

## Usage example: "Search as we type" searchbar
Expand Down
Loading

0 comments on commit 527b04f

Please sign in to comment.