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

Backport master latest changes to next #10284

Merged
merged 13 commits into from
Oct 17, 2024
25 changes: 24 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
branches:
- master
- next
tags:
- '*'
pull_request:

jobs:
Expand Down Expand Up @@ -57,6 +59,7 @@ jobs:

doc-check:
runs-on: ubuntu-latest
if: github.ref_type != 'tag'
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -99,6 +102,7 @@ jobs:

e-commerce:
runs-on: ubuntu-latest
if: github.ref_type != 'tag'
needs: [typecheck]
steps:
- name: Checkout
Expand Down Expand Up @@ -133,6 +137,7 @@ jobs:

crm:
runs-on: ubuntu-latest
if: github.ref_type != 'tag'
needs: [typecheck]
steps:
- name: Checkout
Expand All @@ -157,7 +162,7 @@ jobs:
runs-on: ubuntu-latest
name: GreenFrame
needs: [e-commerce]
if: success() && github.ref == 'refs/heads/master'
if: github.event_name == 'push' && github.ref_type == 'tag' && github.ref_name == 'refs/tags/v*' && !contains('beta', github.ref_name) && !contains('alpha', github.ref_name)
steps:
# To use this repository's private action,
# you must check out the repository
Expand Down Expand Up @@ -208,3 +213,21 @@ jobs:
- name: Run the tests
working-directory: ./myadmin
run: npm run test

update-sandbox-repository:
runs-on: ubuntu-latest
# Only run on new tags that target a release (not latest nor next) and avoid alpha and beta tags
if: github.event_name == 'push' && github.ref_type == 'tag' && github.ref_name == 'refs/tags/v*' && !contains('beta', github.ref_name) && !contains('alpha', github.ref_name)
needs: [typecheck, simple-example-typecheck, unit-test, e2e-test]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Use Node.js LTS
uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: Update Sandbox Repository
env:
SSH_SANDBOX_DEPLOY_KEY: ${{ secrets.SSH_SANDBOX_DEPLOY_KEY }}
SANDBOX_REPOSITORY: ${{ secrets.SANDBOX_REPOSITORY }}
run: make update-sandbox
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,6 @@ storybook: ## Launch the storybook
build-storybook: ## Build the storybook
@echo "Building storybook..."
@yarn build-storybook

update-sandbox: ## Push the local version of the simple example to the sandbox repository
./scripts/update-sandbox.sh
10 changes: 1 addition & 9 deletions docs/documentation.html
Original file line number Diff line number Diff line change
Expand Up @@ -264,15 +264,7 @@ <h2>Recipes</h2>
class="needHelp"
style="text-align: center; padding-top: 0; color: #888"
>
Need help with your React-admin app?
<br />
Turn to Marmelab, its creators and seasoned full-stack
JS development agency.
<br />
<a href="mailto:react-admin-ee@marmelab.com"
>Get in touch</a
>
to hire an expert for a day, or a team for a month.
{% include newsletter.html %}
</div>

<div class="col s12 m9">
Expand Down
18 changes: 16 additions & 2 deletions packages/ra-core/src/auth/useAuthState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,23 +108,37 @@ const useAuthState = <ErrorType = Error>(

useEffect(() => {
if (queryResult.data === undefined || queryResult.isFetching) return;
if (queryOptions.enabled === false) return;
onSuccessEvent(queryResult.data);
}, [onSuccessEvent, queryResult.data, queryResult.isFetching]);
}, [
onSuccessEvent,
queryResult.data,
queryResult.isFetching,
queryOptions.enabled,
]);

useEffect(() => {
if (queryResult.error == null || queryResult.isFetching) return;
if (queryOptions.enabled === false) return;
onErrorEvent(queryResult.error);
}, [onErrorEvent, queryResult.error, queryResult.isFetching]);
}, [
onErrorEvent,
queryResult.error,
queryResult.isFetching,
queryOptions.enabled,
]);

useEffect(() => {
if (queryResult.status === 'pending' || queryResult.isFetching) return;
if (queryOptions.enabled === false) return;
onSettledEvent(queryResult.data, queryResult.error);
}, [
onSettledEvent,
queryResult.data,
queryResult.error,
queryResult.status,
queryResult.isFetching,
queryOptions.enabled,
]);

const result = useMemo(() => {
Expand Down
33 changes: 33 additions & 0 deletions scripts/update-sandbox.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

# Configure git
git config --global user.email "react-admin@marmelab.com"
git config --global user.name "React-Admin CI"

# Configure ssh keys
mkdir --parents "$HOME/.ssh"
DEPLOY_KEY_FILE="$HOME/.ssh/deploy_key"
echo "${SSH_SANDBOX_DEPLOY_KEY}" > "$DEPLOY_KEY_FILE"
chmod 600 "$DEPLOY_KEY_FILE"
SSH_KNOWN_HOSTS_FILE="$HOME/.ssh/known_hosts"
ssh-keyscan -H github.com > "$SSH_KNOWN_HOSTS_FILE"

# Override the default git ssh command so that it includes our ssh key
export GIT_SSH_COMMAND="ssh -i "$DEPLOY_KEY_FILE" -o UserKnownHostsFile=$SSH_KNOWN_HOSTS_FILE"

# Clone the demo repository inside a temporary directory
TEMPD=$(mktemp -d)
echo $TEMPD
(git clone ${SANDBOX_REPOSITORY} $TEMPD)

# Clean it up to ensure we don't keep deleted files
(rm -rf $TEMPD/src)
(rm -rf $TEMPD/assets)

# Copy the demo files into the temporary directory
(cp -r ./examples/simple/. $TEMPD)
# Install dependencies to that the sandbox has a lock file
yarn install --cwd $TEMPD

# Update the demo repository
(cd $TEMPD && git add -A && git commit --allow-empty -m "Update sandbox" && git push)
Loading