Skip to content

Commit

Permalink
Merge pull request #2474 from patzick/feature/refactor-logger-and-tsc…
Browse files Browse the repository at this point in the history
…onfig

Feature/refactor logger and tsconfig
  • Loading branch information
filrak committed Feb 21, 2019
2 parents efab458 + d0f8ca5 commit e9ff100
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Null sidebar menu data on static page fixed - @filrak (#2456)
- Fix cannot edit previous steps in checkout - @filrak (#2457)
- Improve images loading on category page, corrected alt view and blinking problem - @patzick (#2465)
- Improve tsconfig for better IDE paths support - @patzick, @filrak (#2474)


### Deprecated / Removed
Expand Down
8 changes: 5 additions & 3 deletions core/lib/search.ts
Expand Up @@ -6,6 +6,7 @@ import rootStore from '@vue-storefront/core/store'
import { getSearchAdapter } from './search/adapter/searchAdapterFactory'
import { SearchRequest } from '@vue-storefront/core/types/search/SearchRequest'
import { SearchResponse } from '@vue-storefront/core/types/search/SearchResponse'
import { Logger } from '@vue-storefront/core/lib/logger'

// TODO - use one from helpers instead
export function isOnline () : boolean {
Expand Down Expand Up @@ -61,7 +62,8 @@ export const quickSearchByQuery = async ({ query, start = 0, size = 50, entityT
res.noresults = false
res.offline = !isOnline() // TODO: refactor it to checking ES heartbit
resolve(res)
console.debug('Result from cache for ' + cacheKey + ' (' + entityType + '), ms=' + (new Date().getTime() - benchmarkTime.getTime()))
Logger.debug('Result from cache for ' + cacheKey + ' (' + entityType + '), ms=' + (new Date().getTime() - benchmarkTime.getTime()))()

servedFromCache = true
}
}).catch((err) => {
Expand All @@ -87,7 +89,7 @@ export const quickSearchByQuery = async ({ query, start = 0, size = 50, entityT
if (res) { // otherwise it can be just a offline mode
cache.setItem(cacheKey, res, null, rootStore.state.config.elasticsearch.disableLocalStorageQueriesCache).catch((err) => { console.error('Cannot store cache for ' + cacheKey + ', ' + err) })
if (!servedFromCache) { // if navigator onLine == false means ES is unreachable and probably this will return false; sometimes returned false faster than indexedDb cache returns result ...
console.debug('Result from ES for ' + cacheKey + ' (' + entityType + '), ms=' + (new Date().getTime() - benchmarkTime.getTime()))
Logger.debug('Result from ES for ' + cacheKey + ' (' + entityType + '), ms=' + (new Date().getTime() - benchmarkTime.getTime()))()
res.cache = false
res.noresults = false
res.offline = false
Expand All @@ -96,7 +98,7 @@ export const quickSearchByQuery = async ({ query, start = 0, size = 50, entityT
}
}).catch(err => {
if (!servedFromCache) {
console.debug('No results and offline ' + cacheKey + ' (' + entityType + '), ms=' + (new Date().getTime() - benchmarkTime.getTime()))
Logger.debug('No results and offline ' + cacheKey + ' (' + entityType + '), ms=' + (new Date().getTime() - benchmarkTime.getTime()))()
const res = {
items: [],
total: 0,
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Expand Up @@ -19,7 +19,8 @@
"paths": {
"core/*": ["core/*"],
"theme/*": ["src/themes/default/*"], //needs testing with non-default theme!
"core/modules/*": ["./core/modules/*"]
"core/modules/*": ["./core/modules/*"],
"@vue-storefront/*": ["./"]
},
"lib": ["es2017", "dom"]
},
Expand All @@ -31,7 +32,6 @@
"core/**/*.vue",
"tests/**/*.ts",
"module/**/*.ts",
"core/build/theme-path.js"
],
"exclude": [
"node_modules"
Expand Down

0 comments on commit e9ff100

Please sign in to comment.