From c34f6d3462ba4f892fbeda296dd4d9dd72698c76 Mon Sep 17 00:00:00 2001 From: Jack Lukic Date: Mon, 15 Feb 2016 21:08:41 -0800 Subject: [PATCH] Fixes issue where cache local was not working because debug code --- RELEASE-NOTES.md | 11 ++++++++--- src/definitions/behaviors/api.js | 5 ++--- src/definitions/modules/dropdown.js | 13 +++++++++---- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 1e83fe67c..6cec1f19c 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -6,20 +6,25 @@ - **Dropdown** - All dropdowns, not just `selection dropdown`, will now select the first `menu item` that starts with a pressed keyboard key, for example "N" will select "New" - **Build Tools** - Added new `autoInstall` option to allow for Semantic to be installed without user interaction. See [docs explanation](http://www.semantic-ui.com/introduction/advanced-usage.html#Auto-Install) for how to use. #3616 **Thanks @algorithme** +**Critical Bugs** +- **API** - Fixed bug causing `cache: 'local'` not to return the localstorage cached results in some cases +- **API** - Fixes bug where `beforeSend` would not correctly cancel request when `return false;` is used in callback. #3660 +-**Form Validation / Dropdown** - Fixed issue where using "enter" key in a `search dropdown` could cause a form to be submitted #3676 +-**Divider** - Fixed issue where descenders like "g" would be cut off in `horizontal divider` #3585 + **Bugs** +- **Dropdown** - Fixed issue where `apiSettings` was not defaulting to use `cache: 'local'` as specified in the docs - **Dropdown** - Fixed issue where dropdowns with sub-menus would not properly activate on mobile #3183 -- **API** - Fixes bug where `beforeSend` would not correctly cancel request when `return false;` is used in callback. #3660 - **Modal** - Fixes issue where RGB values set for dimmer `background-color` werent being correctly interpreted #3665 **Thanks @larsbo** - **Form** - Fixed use of deprecated `size()` method in `prompt` #3655 **Thanks @SimonArdrey** -**Table** - Fixed issue where `striped selectable` table would not correctly show hover color on striped rows -**Segment/Message** - Fixed issue where `top attached message` would have no border when attached to `segment` #3619 --**Divider** - Fixed issue where descenders like "g" would be cut off in `horizontal divider` #3585 -**Popup** - Fixed issue where checking `instanceof SVGGraphicsElement` caused error in IE11 #3043 --**Form Validation / Dropdown** - Fixed issue where using "enter" key in a `search dropdown` could cause a form to be submitted #3676 -**Button** - Fixes issue where `right icon` like `right arrow icon` would have additional margin inside an `icon button` #3525 **Grid** - Fixed issue where `centered` content would cause `justified` content to appear aligned left. #3496 **Enhancements** +-**Dropdown** - Using API with dropdown will now -**Site** `@px` and `@relativepx` i.e. `@relative12px` which can be used to return EM value of pixels are now extended to `@relative40px` -**Tabs** - Added option `deactivate`, defaults to `siblings` which will only deactivate tab activators that are DOM siblings elements to the activating element. Setting it to 'all' will deactivate any other tab element initialized at the same time. -**Table** - Added more granular variablaes for controlling style on first column in a `definition table` diff --git a/src/definitions/behaviors/api.js b/src/definitions/behaviors/api.js index d8f8d6dab..f836c103e 100644 --- a/src/definitions/behaviors/api.js +++ b/src/definitions/behaviors/api.js @@ -141,7 +141,7 @@ $.api = $.fn.api = function(parameters) { response = sessionStorage.getItem(url); module.debug('Using cached response', url, response); response = module.decode.json(response); - return false; + return response; } }, write: { @@ -233,7 +233,6 @@ $.api = $.fn.api = function(parameters) { module.debug('Querying URL', ajaxSettings.url); module.verbose('Using AJAX settings', ajaxSettings); - if(settings.cache === 'local' && module.read.cachedResponse(url)) { module.debug('Response returned from local cache'); module.request = module.create.request(); @@ -752,7 +751,7 @@ $.api = $.fn.api = function(parameters) { if( module.is.input() ) { data.value = $module.val(); } - else if( !module.is.form() ) { + else if( module.is.form() ) { } else { diff --git a/src/definitions/modules/dropdown.js b/src/definitions/modules/dropdown.js index 036925950..8d9a730e2 100644 --- a/src/definitions/modules/dropdown.js +++ b/src/definitions/modules/dropdown.js @@ -260,7 +260,11 @@ $.fn.dropdown = function(parameters) { api: function() { var apiSettings = { - debug : settings.debug, + debug : settings.debug, + urlData : { + value : module.get.value(), + query : module.get.query() + }, on : false } ; @@ -652,9 +656,10 @@ $.fn.dropdown = function(parameters) { queryRemote: function(query, callback) { var apiSettings = { - errorDuration : false, - throttle : settings.throttle, - urlData : { + errorDuration : false, + cache : 'local', + throttle : settings.throttle, + urlData : { query: query }, onError: function() {