Skip to content

Commit 7ad55ad

Browse files
authored
Fixes invalidated module not resolving promises (#349)
1 parent 573221c commit 7ad55ad

11 files changed

Lines changed: 38 additions & 184 deletions

File tree

cpp/OPSqlite.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ void install(jsi::Runtime &rt,
5151
_crsqlite_path = std::string(crsqlite_path);
5252
_sqlite_vec_path = std::string(sqlite_vec_path);
5353
opsqlite::invoker = invoker;
54+
opsqlite::invalidated = false;
5455

5556
auto open = HFN0 {
5657
jsi::Object options = args[0].asObject(rt);

example/babel.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ const root = path.resolve(__dirname, '..');
77
module.exports = getConfig(
88
{
99
presets: ['module:@react-native/babel-preset'],
10-
plugins: ['nativewind/babel'],
1110
},
1211
{root, pkg},
1312
);

example/globals.d.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

example/ios/OPSQLiteExample/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33
<plist version="1.0">
44
<dict>
5-
<key>CADisableMinimumFrameDurationOnPhone</key>
5+
<key>CADisableMinimumFrameDurationOnPhone</key>
66
<true/>
77
<key>CFBundleDevelopmentRegion</key>
88
<string>en</string>
@@ -34,7 +34,7 @@
3434
<true/>
3535
</dict>
3636
<key>NSLocationWhenInUseUsageDescription</key>
37-
<string></string>
37+
<string>Location is needed</string>
3838
<key>RCTNewArchEnabled</key>
3939
<true/>
4040
<key>UILaunchStoryboardName</key>

example/ios/Podfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2027,7 +2027,7 @@ EXTERNAL SOURCES:
20272027
SPEC CHECKSUMS:
20282028
FBLazyVector: 2e5b5553df729e080483373db6f045201ff4e6db
20292029
hermes-engine: 273e30e7fb618279934b0b95ffab60ecedb7acf5
2030-
op-sqlite: 7e1d781318b8f936bd7afe0773cf0d2e0b81780b
2030+
op-sqlite: dab20bf7d412623996a2247014d04a8cbb1ccb0a
20312031
OpServer: 63fc523290a5c7c6f98dc7ba5e76cc720d798259
20322032
RCTDeprecation: c6b36da89aa26090c8684d29c2868dcca2cd4554
20332033
RCTRequired: 1413a0844770d00fa1f1bb2da4680adfa8698065

example/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
"chance": "^1.1.9",
2121
"clsx": "^2.0.0",
2222
"events": "^3.3.0",
23-
"nativewind": "^2.0.11",
2423
"react": "19.1.1",
2524
"react-native": "0.82.1",
2625
"react-native-safe-area-context": "^5.6.2"

example/src/App.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
allTestsPassed,
1111
} from '@op-engineering/op-test';
1212
import './tests'; // import all tests to register them
13-
import {SafeAreaView} from 'react-native-safe-area-context';
13+
import {SafeAreaView, SafeAreaProvider} from 'react-native-safe-area-context';
1414
import {StyleSheet} from 'react-native';
1515

1616
export default function App() {
@@ -54,15 +54,17 @@ export default function App() {
5454
// };
5555

5656
return (
57-
<SafeAreaView style={STYLES.container}>
58-
{displayResults(results)}
59-
</SafeAreaView>
57+
<SafeAreaProvider>
58+
<SafeAreaView style={STYLES.container}>
59+
{displayResults(results)}
60+
</SafeAreaView>
61+
</SafeAreaProvider>
6062
);
6163
}
6264

6365
const STYLES = StyleSheet.create({
6466
container: {
65-
height: '100%',
67+
flex: 1,
6668
backgroundColor: '#333',
6769
},
6870
});

example/src/globals.d.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

example/src/tests/dbsetup.ts

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -270,12 +270,12 @@ it('Can get db path', () => {
270270
db.close();
271271
});
272272

273-
if(isLibsql()) {
274-
it("Libsql can set reserved bytes", async () => {
275-
const db = open({ name: "test.db" });
276-
db.setReservedBytes(28);
277-
expect(db.getReservedBytes()).toEqual(28);
278-
db.delete()
273+
if (isLibsql()) {
274+
it('Libsql can set reserved bytes', async () => {
275+
const db = open({name: 'test.db'});
276+
db.setReservedBytes(28);
277+
expect(db.getReservedBytes()).toEqual(28);
278+
db.delete();
279279
});
280280
}
281281

@@ -288,3 +288,15 @@ if (isSQLCipher()) {
288288
db.close();
289289
});
290290
}
291+
292+
// This test wasn't really failing, but the module was not being properly
293+
// invalidated/re-created on a hot reload
294+
// Check opsqlite::invalidated
295+
// itOnly('Can execute async pragma', async () => {
296+
// const db = open({
297+
// name: 'pragma.sqlite',
298+
// });
299+
300+
// const result = await db.execute('select sqlite_version() as version');
301+
// expect(result).toBe('1.52');
302+
// });

package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,5 @@
109109
"type": "turbo-module",
110110
"version": "0.52.1"
111111
},
112-
"packageManager": "yarn@4.11.0",
113-
"dependencies": {
114-
"react-native-safe-area-context": "^5.6.2"
115-
}
112+
"packageManager": "yarn@4.11.0"
116113
}

0 commit comments

Comments
 (0)