rnmapbox / rnmapbox/maps

[Bug]: offlineManager.resetDatabase not clearing pack list

Open
#3,076 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Kotlin
Stars
2.9k
Forks
947
Avg merge
6d 37m
Merged PRs (30d)
1

Description

Mapbox Implementation

Mapbox

Mapbox Version

default

Platform

iOS, Android

@rnmapbox/maps version

10.0.15

Standalone component to reproduce


import { offlineManager } from '@rnmapbox/maps'
import React, { useEffect } from 'react';

function resetDBbug() {
  useEffect(() => {
    const resetDB = async () => {
      await offlineManager.resetDatabase();
      const packs = (await offlineManager.getPacks());
    }
    resetDB();
  }, [])
}
Observed behavior and steps to reproduce

When calling await offlineManager.resetDatabase() and then getting again the list of offline packs, the list remains the same.

This is true after having awated the response from the async resetDatabase and is true even if we wait for several seconds before calling offlineManager.getPacks().

Calling await pack.status() on any of these packs though will result in "Does not exist" exception.

Expected behavior

The result of await offlineManager.getPacks() should be an empty list, as the offline tile packs should have been cleared.

Notes / preliminary analysis

Restarting the app completely and calling getPacks() will return correctly an empty list.

Additional links and references

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the standalone JavaScript reproduction using offlineManager.resetDatabase() and offlineManager.getPacks(), comparing behavior before and after an app restart. Trace the React Native and Kotlin implementation of these APIs; done means resetDatabase resolves and a subsequent getPacks() returns an empty list without pack.status() failures.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, kotlin, react-native
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.