Skip to content

fix: minor cleanup#1232

Merged
ErnestM1234 merged 2 commits intomainfrom
e/gt-react-native/cleanup-extra-code
Apr 23, 2026
Merged

fix: minor cleanup#1232
ErnestM1234 merged 2 commits intomainfrom
e/gt-react-native/cleanup-extra-code

Conversation

@ErnestM1234
Copy link
Copy Markdown
Contributor

@ErnestM1234 ErnestM1234 commented Apr 22, 2026

Greptile Summary

This is a minor cleanup PR for the gt-react-native package that fixes several small issues: incorrect import paths in the example app, a duplicate setLocaleWithoutPersist call, leftover scaffold code (multiply), and adds SSR guards for localStorage access. The console.log on polyfill success is also removed, aligning with the repo's no-debug-logging policy.

Confidence Score: 5/5

Safe to merge — all changes are straightforward bug fixes and cleanup with no functional regressions.

No P0 or P1 issues found. All changes are correct: import path fixes, duplicate-call elimination, SSR guard additions, scaffold removal, and removal of debug logging. The dependency array change in useEffect (dropping the non-memoized setLocaleWithoutPersist) is correct and prevents a potential infinite re-render loop.

No files require special attention.

Important Files Changed

Filename Overview
packages/react-native/src/utils/nativeStore.ts Added SSR guard for localStorage in both nativeStoreGet and nativeStoreSet, warning and returning early when running in a server-side environment where localStorage is unavailable.
packages/react-native/src/provider/hooks/locale/useDetermineLocale.ts Removed duplicate setLocaleWithoutPersist(newLocale) call, removed it from the useEffect dependency array (it's a non-memoized function ref), and switched the unsupported locale warning to the shared createUnsupportedLocaleWarning helper.
packages/react-native/src/tools/testLocalePolyfill.ts Removed console.log on polyfill success path (aligns with no-debug-logging rule) and simplified catch (e) to catch across all 8 Intl try/catch blocks.
packages/react-native/src/index.tsx Removed leftover scaffold multiply function and its associated GtReactNative import, which were never part of the intended public API.
examples/react-native/src/App.tsx Fixed incorrect import paths from '../src/_gt/...' to './_gt/...' — the file is already inside src/, so the old paths pointed to a non-existent src/src/_gt/ directory.
packages/react-native/STYLE_GUIDE.md New architecture and style guide documenting native module rules, export entry points, persistence patterns, and common pitfalls for the gt-react-native package.
packages/react-native/src/errors-dir/warnings.ts Added ssrUnsupportedWarning constant used by the new SSR guard in nativeStore.ts.
.changeset/brown-ducks-cross.md New changeset entry marking this as a patch release for gt-react-native.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["nativeStoreGet / nativeStoreSet"] --> B{Platform.OS === 'web'?}
    B -- Yes --> C{typeof localStorage === 'undefined'?}
    C -- Yes --> D["console.warn(ssrUnsupportedWarning)\nreturn null / return"]
    C -- No --> E["localStorage.getItem / setItem"]
    B -- No --> F["GtReactNative.nativeStoreGet / nativeStoreSet"]
Loading

Reviews (1): Last reviewed commit: "remove styleguide" | Re-trigger Greptile

Context used:

  • Rule used - Remove console.log statements and debug logging fr... (source)

Learned From
generaltranslation/gt-cloud#1266
generaltranslation/gt-cloud#1240

@ErnestM1234 ErnestM1234 requested a review from a team as a code owner April 22, 2026 23:12
Copy link
Copy Markdown
Contributor

@fernando-aviles fernando-aviles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@ErnestM1234 ErnestM1234 merged commit 485fa93 into main Apr 23, 2026
28 checks passed
@ErnestM1234 ErnestM1234 deleted the e/gt-react-native/cleanup-extra-code branch April 23, 2026 00:05
@github-actions github-actions Bot mentioned this pull request Apr 23, 2026
ErnestM1234 pushed a commit that referenced this pull request Apr 23, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## gt-next@6.16.9

### Patch Changes

-   Updated dependencies \[]:
    -   gt-react@10.19.2

## @generaltranslation/gt-next-lint@14.0.9

### Patch Changes

-   Updated dependencies \[]:
    -   gt-next@6.16.9

## gt-react-native@10.19.2

### Patch Changes

- [#1232](#1232)
[`485fa93`](485fa93)
Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - fix: clean up
minor issues

## gt-tanstack-start@0.4.6

### Patch Changes

-   Updated dependencies \[]:
    -   gt-react@10.19.2

## gt-react@10.19.2

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants