Skip to content

Commit

Permalink
improve style handling
Browse files Browse the repository at this point in the history
  • Loading branch information
mki-c2c committed Aug 8, 2024
1 parent 718dac6 commit 9482534
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/style-selection.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('Style selector', () => {
})

it('has no style value in localStorage', () => {
expect(localStorage.getItem('basemap_2015_global') || '').to.eq('')
expect(localStorage.getItem('basemap_2015_global')).to.be.null
})

describe('Style panel', () => {
Expand Down
14 changes: 9 additions & 5 deletions src/services/state-persistor/state-persistor-bgstyle.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,15 @@ class StatePersistorStyleService {
mapStore.bgLayer &&
styleStore.bgVectorSources.has(mapStore.bgLayer.id)
) {
storageHelper.setValue(
mapStore.bgLayer.name,
value || [],
storageStyleMapper.styleToLocalStorage
)
if (value && value.length) {
storageHelper.setValue(
mapStore.bgLayer.name,
value || [],
storageStyleMapper.styleToLocalStorage
)
} else {
storageHelper.removeItem(mapStore.bgLayer.name)
}
storageHelper.setValue(
SP_KEY_SERIAL,
value || [],
Expand Down

0 comments on commit 9482534

Please sign in to comment.