Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed / Improved
- Optimized `translation.processor` to process only enabled locale CSV files - @pkarw (#3950)
- Remove commit register mapping - @gibkigonzo (#3875)

## [1.11.0] - 2019.12.20

Expand Down
7 changes: 4 additions & 3 deletions core/modules/url/store/actions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { UrlState } from '../types/UrlState'
import { ActionTree } from 'vuex';
import * as types from './mutation-types'
// you can use this storage if you want to enable offline capabilities
import { cacheStorage } from '../'
import queryString from 'query-string'
Expand All @@ -13,8 +12,10 @@ import storeCodeFromRoute from '@vue-storefront/core/lib/storeCodeFromRoute'
// it's a good practice for all actions to return Promises with effect of their execution
export const actions: ActionTree<UrlState, any> = {
// if you want to use cache in your module you can load cached data like this
async registerMapping ({ commit }, { url, routeData }: { url: string, routeData: any}) {
commit(types.REGISTER_MAPPING, { url, routeData })
async registerMapping ({ state }, { url, routeData }: { url: string, routeData: any}) {
if (!state.dispatcherMap[url]) {
state.dispatcherMap[url] = routeData
}
try {
await cacheStorage.setItem(normalizeUrlPath(url), routeData, null, config.seo.disableUrlRoutesPersistentCache)
} catch (err) {
Expand Down
2 changes: 0 additions & 2 deletions core/modules/url/store/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { Module } from 'vuex'
import { UrlState } from '../types/UrlState'
import { mutations } from './mutations'
import { actions } from './actions'
import { state } from './state'

export const urlStore: Module<UrlState, any> = {
namespaced: true,
mutations,
actions,
state
}
1 change: 0 additions & 1 deletion core/modules/url/store/mutation-types.ts

This file was deleted.

8 changes: 0 additions & 8 deletions core/modules/url/store/mutations.ts

This file was deleted.

9 changes: 3 additions & 6 deletions core/modules/url/test/unit/store/actions.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as types from '@vue-storefront/core/modules/url/store/mutation-types';
import { cacheStorage } from '@vue-storefront/core/modules/recently-viewed/index';
import { actions as urlActions } from '../../../store/actions';
import { currentStoreView, localizedDispatcherRouteName } from '@vue-storefront/core/lib/multistore';
Expand Down Expand Up @@ -75,17 +74,15 @@ describe('Url actions', () => {
describe('registerMapping action', () => {
it('should call register mapping mutation', async () => {
const contextMock = {
commit: jest.fn()
state: {
dispatcherMap: {}
}
};
const result = await (urlActions as any).registerMapping(contextMock, {
url,
routeData
});

expect(contextMock.commit).toHaveBeenCalledWith(types.REGISTER_MAPPING, {
url,
routeData
});
expect(result).toEqual(routeData);
});
});
Expand Down
30 changes: 0 additions & 30 deletions core/modules/url/test/unit/store/mutations.spec.ts

This file was deleted.