You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It used to be possible to disable the initial command by passing in an empty initial command. The new version of the browser (currently testing on browser version 3.1.7) does not appear to allow this behavior.
Reproduce Steps
Set the initCmd value to a blank value via any of the following ways:
In the browser:
:config initCmd: ''
in neo4j.conf:
browser.post_connect_cmd=''
as an environment variable when starting up neo4j:
NEO4J_browser_post__connect__cmd=
Expected Behavior
The browser accepts the configuration parameter and respects it by not running the default command of :play intro
Current Behavior
The browser accepts the configuration parameter but does not respect it. If the configuration parameter is a falsey value, such as an empty string, the default command is run.
Can you propose a solution?
The beginning of this issue can be solved by adjusting the following line of code:
Good catch @freethejazz!
This is definitely a classic js bug, checking a falsey value on something when empty string (or zero in many cases) are something you want to handle.
And you're right, an empty string will probably be interpreted as cypher and sent to the server and return with an error message.
So either we need to validate the initCmd command and not pass it forward or we need to set a guard before sending cypher to the server.
Personally I think validating the initCmd and stop it early if empty is preferred.
If you'd like to submit a PR for it, that'd be awesome!
Description
It used to be possible to disable the initial command by passing in an empty initial command. The new version of the browser (currently testing on browser version 3.1.7) does not appear to allow this behavior.
Reproduce Steps
Set the
initCmd
value to a blank value via any of the following ways:In the browser:
in neo4j.conf:
as an environment variable when starting up neo4j:
Expected Behavior
The browser accepts the configuration parameter and respects it by not running the default command of
:play intro
Current Behavior
The browser accepts the configuration parameter but does not respect it. If the configuration parameter is a falsey value, such as an empty string, the default command is run.
Can you propose a solution?
The beginning of this issue can be solved by adjusting the following line of code:
neo4j-browser/src/shared/modules/settings/settingsDuck.js
Line 30 in 5462db5
If the
initCmd
is defined but falsey, theinitialState.initCmd
value is used instead (:play intro
)Simply altering that line to read something like:
may work, but there may be downstream issues when attempting to execute a command that's just an empty string.
I'm up for creating a PR for this if you all find it valuable. Thanks and keep up the great work!
The text was updated successfully, but these errors were encountered: