Random fixes (#8874)

* sort desc lastAccessAt server in security manager

* do not export let binding in context/device
This commit is contained in:
Elias Nahum 2025-05-20 22:40:11 +08:00 committed by GitHub
parent 42a54407a4
commit 190be37fe0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -11,7 +11,7 @@ type Props = {
const emitter = new NativeEventEmitter(RNUtils); const emitter = new NativeEventEmitter(RNUtils);
export let info = RNUtils.isRunningInSplitView(); let info = RNUtils.isRunningInSplitView();
export const DeviceContext = createContext(info); export const DeviceContext = createContext(info);
const {Provider} = DeviceContext; const {Provider} = DeviceContext;

View file

@ -273,7 +273,7 @@ class SecurityManagerSingleton {
* Gets the last accessed server. * Gets the last accessed server.
*/ */
getLastAccessedServer = (otherServers: string[]) => { getLastAccessedServer = (otherServers: string[]) => {
const lastAccessed = otherServers.map((s) => this.serverConfig[s].lastAccessed).sort().reverse()[0]; const lastAccessed = otherServers.map((s) => this.serverConfig[s].lastAccessed).sort((a: number, b: number) => b - a)[0];
return Object.keys(this.serverConfig).find((s) => this.serverConfig[s].lastAccessed === lastAccessed); return Object.keys(this.serverConfig).find((s) => this.serverConfig[s].lastAccessed === lastAccessed);
}; };