Skip to content

Commit

Permalink
Merge branch 'main' into fp/core-logging
Browse files Browse the repository at this point in the history
* main: (41 commits)
  allow useQuery to filter or sort a collection by using a callback (#5513)
  Fix `realm.create` types and 'requiredProperties' on Realm.Object constructor (#5697)
  Fix return type of `App.allUsers` (#5708)
  Removed renamed file
  Remove console.log
  Fix README instructions and bump version
  Bump template versions
  Update Templates (#5702)
  Moved "submodules" wireit task to "postinstall"
  Set up typedoc for realm-react, realm-web (#5709)
  Prepare for vNext (#5711)
  Prepare for 12.0.0-alpha.2 (#5707)
  Build iOS prebuilds in release by default (#5710)
  Use the event.sender as assignee when preparing release
  Updated prepare release workflow to print PR url in summary
  Fixing lint error
  fix the template app links (#5701)
  Expose `Sync` as named export (#5705)
  Enable all tests after bad rebase (#5595)
  Clear test state flag (#5689)
  ...

# Conflicts:
#	packages/realm/src/Realm.ts
  • Loading branch information
papafe committed Apr 13, 2023
2 parents ef68b27 + 1c7f11c commit b8950b6
Show file tree
Hide file tree
Showing 359 changed files with 3,324 additions and 36,353 deletions.
25 changes: 14 additions & 11 deletions .github/workflows/package-unit-tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Package Unit Tests
name: Unit tests

env:
REALM_DISABLE_ANALYTICS: 1
Expand All @@ -8,30 +8,33 @@ on:
pull_request:
paths:
# Source code
- "packages/realm-network-transport/**"
- "packages/realm-common/**"
- "packages/**"
# No need to run when updating documentation
- "!**.md"
# Run this on updates to the workflow
- ".github/workflows/package-unit-tests.yml"

jobs:
unit-tests-linux:
name: Unit tests on Linux
strategy:
fail-fast: false
matrix:
workspace:
- realm
- '@realm/bindgen'
- '@realm/network-transport'
- '@realm/babel-plugin'
- '@realm/react'
name: ${{ matrix.workspace }} unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: "recursive"
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- name: Install npm v7
run: npm install -g npm@8
node-version: 18
# Install the root package to get dev-dependencies
# (--ignore-scripts to avoid downloading or building the native module)
- run: npm ci --ignore-scripts
- run: npm run lerna:bootstrap -- --scope '{@realm/network-transport,@realm/common}' --include-dependencies
- run: npm test --prefix packages/realm-network-transport
- run: npm test --prefix packages/realm-common
- run: npm test --workspace ${{ matrix.workspace }}
67 changes: 0 additions & 67 deletions .github/workflows/pr-babel-plugin.yml

This file was deleted.

4 changes: 3 additions & 1 deletion .github/workflows/pr-realm-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,10 @@ jobs:
- name: Build iOS
if: ${{ (matrix.variant.os == 'ios') }}
run: |
npm run build:ios --workspace realm -- ${{matrix.variant.arch}}
npm run build:ios --workspace realm
rm -vf ${{ matrix.variant.artifact-path }}/Info.plist
env:
PLATFORMS: ${{ matrix.variant.arch }}

# build the c++ library for Android
- name: Build Android
Expand Down
70 changes: 0 additions & 70 deletions .github/workflows/pr-realm-react.yml

This file was deleted.

7 changes: 6 additions & 1 deletion .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,15 @@ jobs:
run: npm version ${{ steps.update-changelog.outputs.new-version }} --workspace realm

- name: Create Release PR
uses: peter-evans/create-pull-request@7380612b49221684fefa025244f2ef4008ae50ad #! 3.10.1
uses: peter-evans/[email protected]
id: create-pr
with:
branch: release/${{ steps.update-changelog.outputs.new-version }}
title: Prepare for ${{ steps.update-changelog.outputs.new-version }}
body: An automated PR for next release.
commit-message: "[${{ steps.update-changelog.outputs.new-version }}] Bump version"
token: ${{ secrets.REALM_CI_PAT }}
assignees: ${{ github.event.sender }}

- name: Update summary
run: echo "Created [PR for v${{ steps.update-changelog.outputs.new-version }}](${{ steps.create-pr.outputs.pull-request-url }})" >> $GITHUB_STEP_SUMMARY
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,8 @@ integration-tests/**/.lock

# Rollup
.rollup.cache/

# Generated docs
/packages/realm/docs/
/packages/realm-react/docs/
/packages/realm-web/docs/
30 changes: 27 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,27 @@
* None

### Enhancements
* None

### Fixed
* <How to hit and notice issue? what was the impact?> ([#????](https://github.com/realm/realm-js/issues/????), since v?.?.?)
* None

### Compatibility
* React Native >= v0.71.0
* Realm Studio v13.0.0.
* File format: generates Realms with format v23 (reads and upgrades file format v5 or later for non-synced Realm, upgrades file format v10 or later for synced Realms).

### Internal
<!-- * Either mention core version or upgrade -->
<!-- * Using Realm Core vX.Y.Z -->
<!-- * Upgraded Realm Core from vX.Y.Z to vA.B.C -->

## 12.0.0-alpha.2 (2023-04-05)

### Enhancements
* Added support for building with the new React Native architecture enabled on Android. Thanks to
Nikolai Samorodov / [@zabutok](https://github.com/zabutok) for contributing the fix. ([#5032](https://github.com/realm/realm-js/issues/5032))
* Exposed `SyncError.logUrl` which contains the URL to the server log related to the sync error. ([#5609](https://github.com/realm/realm-js/issues/5609))
* Added a new error class `CompensatingWriteError` which indicates that one or more object changes have been reverted by the server.
This can happen when the client creates/updates objects that do not match any subscription, or performs writes on an object it didn't have permission to access. ([#5599](https://github.com/realm/realm-js/pull/5599))
Expand All @@ -13,26 +34,29 @@ This can happen when the client creates/updates objects that do not match any su
* Significant (~99%) improvement when querying for a case insensitive match on a `mixed` property that has an index.
* Moderate (~25%) improvement when querying for an exact match on a `bool` property that has an index.
* Small (~5%) improvement when querying for a case insensitive match on a `mixed` property that does not have an index.
* Added a `THROW_ON_GLOBAL_REALM` which will enable throwing when the app is accessing the `Realm` without first importing it from the Realm package.

### Fixed
* Fixed bootstrapping the native module on Android. Seen as Exception in HostObject::get for prop 'Realm': java.lang.NoClassDefFoundError: io.realm.react.RealmReactModule. ([#5666](https://github.com/realm/realm-js/issues/5666), since v12.0.0-alpha.0)
* Fixed passing RealmObject instances between shared Realms. ([#5634](https://github.com/realm/realm-js/pull/5634), since v12.0.0-alpha.0)
* Fixed a crash when querying a `mixed` property with a string operator (`contains`/`like`/`beginswith`/`endswith`) or with case insensitivity. ([realm/realm-core#6376](https://github.com/realm/realm-core/issues/6376, since v10.5.0)
* Querying for equality of a string on an indexed `mixed` property was returning case insensitive matches. For example querying for `myIndexedMixed == "Foo"` would incorrectly match on values of `"foo"` or `"FOO"`. ([realm/realm-core#6376](https://github.com/realm/realm-core/issues/6376), since v10.5.0)
* Adding an index to a `mixed` property on a non-empty class/objectType would crash with an assertion. ([realm/realm-core#6376](https://github.com/realm/realm-core/issues/6376), since v10.5.0)
* `Realm.App.Sync#pause()` could hold a reference to the database open after shutting down the sync session, preventing users from being able to delete the Realm. ([realm/realm-core#6372](https://github.com/realm/realm-core/issues/6372), since v11.5.0)
* Fixed a bug that may have resulted in `Realm.Results` and `Realm.List` being in different orders on different devices. Moreover, some cases of the error message `Invalid prior_size` may have be fixed too. ([realm/realm-core#6191](https://github.com/realm/realm-core/issues/6191), since v10.15.0)
* Exposed `Sync` as named export. [#5649](https://github.com/realm/realm-js/issues/5649)
* Fixed the return value of `App.allUsers` to return a record with the `User.id` as the key and the `User` as the value. [#5671](https://github.com/realm/realm-js/issues/5671)

### Compatibility
* React Native >= v0.71.0
* Realm Studio v13.0.0.
* File format: generates Realms with format v23 (reads and upgrades file format v5 or later for non-synced Realm, upgrades file format v10 or later for synced Realms).

### Internal
* Enabled all tests from v11 and fixed all remaining failures. ([#5595](https://github.com/realm/realm-js/pull/5595))
* Fixed linting issues and running linting on CI.
* Upgraded Realm Core from v13.6.0 to v13.8.0. ([#5638](https://github.com/realm/realm-js/pull/5638))
<!-- * Either mention core version or upgrade -->
<!-- * Using Realm Core vX.Y.Z -->
<!-- * Upgraded Realm Core from vX.Y.Z to vA.B.C -->
* Build iOS prebuilt binaries in release mode by default. ([#5709](https://github.com/realm/realm-js/pull/5709))

## 12.0.0-alpha.1 (2023-03-22)

Expand Down
18 changes: 6 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<picture>
<source srcset="./logo-dark.svg" media="(prefers-color-scheme: dark)" alt="realm by MongoDB">
<img src="./logo.svg" alt="realm by MongoDB">
<source srcset="./media/logo-dark.svg" media="(prefers-color-scheme: dark)" alt="realm by MongoDB">
<img src="./media/logo.svg" alt="realm by MongoDB">
</picture>

Realm is a mobile database that runs directly inside phones, tablets or wearables.
Expand All @@ -12,7 +12,7 @@ This project hosts the JavaScript versions of [Realm](https://realm.io/). Curren
* **Simple:** Data is directly [exposed as objects](https://docs.mongodb.com/realm/node/realms/) and [queryable by code](https://docs.mongodb.com/realm/node/query-engine/), removing the need for ORM's riddled with performance & maintenance issues.
* **Modern:** Realm supports relationships, generics, and vectorization.
* **Fast:** Realm is faster than even raw SQLite on common operations, while maintaining an extremely rich feature set.
* **[Device Sync](https://www.mongodb.com/atlas/app-services/device-sync)**: Makes it simple to keep data in sync across users, devices, and your backend in real-time. [Get started](http://mongodb.com/realm/register?utm_medium=github_atlas_CTA&utm_source=realm_js_github) for free with a template application that includes a cloud backend and Sync.
* **[Device Sync](https://www.mongodb.com/atlas/app-services/device-sync)**: Makes it simple to keep data in sync across users, devices, and your backend in real-time. Get started for free with [a template application](https://github.com/mongodb/template-app-react-native-todo) and [create the cloud backend](http://mongodb.com/realm/register?utm_medium=github_atlas_CTA&utm_source=realm_js_github).

## Getting Started

Expand Down Expand Up @@ -87,16 +87,10 @@ Moreover, we have a [Flipper plugin](https://www.npmjs.com/package/realm-flipper

## Template apps

We have TypeScript and JavaScript templates to help you get started using Realm. Follow the links to your desired template and follow the instructions there to get up and running fast.
### Using Expo
We have TypeScript templates to help you get started using Realm. Follow the links to your desired template and follow the instructions there to get up and running fast.

- [TypeScript](https://github.com/realm/realm-js/tree/main/templates/expo-template-ts#readme)
- [JavaScript](https://github.com/realm/realm-js/tree/main/templates/expo-template-js#readme)

### React Native

- [TypeScript](https://github.com/realm/realm-js/tree/main/templates/react-native-template-realm-ts#readme)
- [JavaScript](https://github.com/realm/realm-js/tree/main/templates/react-native-template-realm-js#readme)
- [Expo](https://github.com/realm/realm-js/tree/main/templates/expo-template#readme)
- [React Native](https://github.com/realm/realm-js/tree/main/templates/react-native-template#readme)
## Getting Help

* **Need help with your code?**: Look for previous questions on the [#realm tag](https://stackoverflow.com/questions/tagged/realm?sort=newest) — or [ask a new question](https://stackoverflow.com/questions/ask?tags=realm). You can also check out our [Community Forum](https://developer.mongodb.com/community/forums/tags/c/realm/9/realm-sdk) where general questions about how to do something can be discussed.
Expand Down
18 changes: 13 additions & 5 deletions example/app/AppNonSync.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
import React, {useMemo} from 'react';
import React from 'react';

import {Task} from './models/Task';
import {TaskManager} from './components/TaskManager';

import {useQuery} from '@realm/react';

export const AppNonSync = () => {
const result = useQuery(Task);
const [showDone, setShowDone] = React.useState(false);
const tasks = useQuery(
Task,
collection =>
showDone
? collection.sorted('createdAt')
: collection.filtered('isComplete == false').sorted('createdAt'),
[showDone],
);

const tasks = useMemo(() => result.sorted('createdAt'), [result]);

return <TaskManager tasks={tasks} />;
return (
<TaskManager tasks={tasks} setShowDone={setShowDone} showDone={showDone} />
);
};
Loading

0 comments on commit b8950b6

Please sign in to comment.