Skip to content

Commit

Permalink
Merge pull request #469 from blazejkustra/ts/storage
Browse files Browse the repository at this point in the history
[TS Migration] Migrate storage, utils and OnyxCache to Typescript
  • Loading branch information
pecanoro authored Feb 15, 2024
2 parents 13936ae + a774228 commit 2c9e038
Show file tree
Hide file tree
Showing 21 changed files with 544 additions and 617 deletions.
14 changes: 14 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,20 @@ module.exports = {
'@typescript-eslint/array-type': ['error', {default: 'array-simple'}],
'@typescript-eslint/consistent-type-definitions': 'off',
'rulesdir/no-multiple-onyx-in-file': 'off',
'valid-jsdoc': 'off',
'rulesdir/prefer-import-module-contents': 'off',
'es/no-optional-chaining': 'off',
'es/no-nullish-coalescing-operators': 'off',
'import/extensions': [
'error',
'ignorePackages',
{
js: 'never',
jsx: 'never',
ts: 'never',
tsx: 'never',
},
],
},
},
{
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ dist/

# Decrypted private key we do not want to commit
.github/OSBotify-private-key.asc

# Published package
*.tgz
4 changes: 2 additions & 2 deletions lib/Onyx.js
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ function keysChanged(collectionKey, partialCollection, notifyRegularSubscibers =
const previousData = prevState[subscriber.statePropertyName];

// Avoids triggering unnecessary re-renders when feeding empty objects
if (utils.areObjectsEmpty(data, previousData)) {
if (utils.isEmptyObject(data) && utils.isEmptyObject(previousData)) {
return null;
}
if (data === previousData) {
Expand Down Expand Up @@ -674,7 +674,7 @@ function keyChanged(key, data, prevData, canUpdateSubscriber = () => true, notif
const prevWithOnyxData = prevState[subscriber.statePropertyName];

// Avoids triggering unnecessary re-renders when feeding empty objects
if (utils.areObjectsEmpty(data, prevWithOnyxData)) {
if (utils.isEmptyObject(data) && utils.isEmptyObject(prevWithOnyxData)) {
return null;
}
if (prevWithOnyxData === data) {
Expand Down
236 changes: 0 additions & 236 deletions lib/OnyxCache.js

This file was deleted.

Loading

0 comments on commit 2c9e038

Please sign in to comment.