Skip to content

Textbox_autocomplete error and simple bridge question #161

Description

@th31nitiate

Hey,

I found this simple issue in the textbox_autocomplete section. I say simple because it don't seem to complex to resolve. The source of the issue might be because I'm using the rebar3 version of nitrogen.

--- a/src/handlers/query/default_query_handler.erl
+++ b/src/handlers/query/default_query_handler.erl
@@ -55,8 +55,10 @@ set_websocket_params(Params, _Config, State) ->
 get_value(Path, Config, State) ->
     case get_values(Path, Config, State) of
         [] -> undefined;
-        [One] -> 
+        [[],One] -> 
             wf:to_unicode_list(One);
+       One ->
+             wf:to_unicode_list(One);
         _Many -> throw({?MODULE, too_many_matches, Path})
     end.

It seems to be just a minor change in how the data is represented in other parts of the program that causes these issues. I also had another question regarding what you mean by It's worth considering reworking this page to use simple_bridge for all the query and post parameter evaluation from the TODO comment in the file.

It appears to me that the file is using simple bridge for most things:

init(_Config, _State) ->
% Get query params and post params
% from the request bridge...
Bridge = wf_context:bridge(),
QueryParams = sbw:query_params(Bridge),
PostParams = sbw:post_params(Bridge),

% Load into state...
Params = QueryParams ++ PostParams,

I'm not sure if I can help much with this part as I'm yet to fully read the simple_bridge readme doc. Though as I say looking at the file it seems as though it's making use of simple bridge.


I guess the code I added there seems to have a logic error. Both One and _Many in the case statement are basically the same thing. I'm wondering what type of error scenario/input were you expecting for the _Many clause ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions