Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Textbox_autocomplete error and simple bridge question #161

Open
th31nitiate opened this issue Oct 14, 2023 · 0 comments
Open

Textbox_autocomplete error and simple bridge question #161

th31nitiate opened this issue Oct 14, 2023 · 0 comments

Comments

@th31nitiate
Copy link

th31nitiate commented Oct 14, 2023

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant