code-battles 1.5.6 → 1.5.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -460,7 +460,7 @@ const useLocalStorage = ({ key, defaultValue, }) => {
460
460
  if (typeof newValue === "function") {
461
461
  newValue = newValue(value);
462
462
  }
463
- if (newValue) {
463
+ if (newValue !== undefined) {
464
464
  localStorage.setItem(key, JSON.stringify(newValue));
465
465
  window.dispatchEvent(new StorageEvent("storage", {
466
466
  key,
@@ -2521,7 +2521,7 @@ const RunSimulationBlock = () => {
2521
2521
  const run = () => {
2522
2522
  // @ts-ignore
2523
2523
  window._isSimulationFromFile = false;
2524
- navigate(`/simulation/${map.replaceAll(" ", "-")}/${playerBots.join("-")}?seed=${seed}`);
2524
+ navigate(`/simulation/${map.replaceAll(" ", "-")}/${playerBots.join("-")}?seed=${seed === "-" ? "" : seed}`);
2525
2525
  };
2526
2526
  const startRunNoUI = () => {
2527
2527
  setRunningNoUI(true);
@@ -15883,7 +15883,6 @@ const LogViewer = ({ playerNames }) => {
15883
15883
  defaultValue: [],
15884
15884
  });
15885
15885
  React.useEffect(() => {
15886
- setLogs([]);
15887
15886
  setShowLogs(playerNames.map(() => true));
15888
15887
  }, [playerNames]);
15889
15888
  React.useEffect(() => {
@@ -15963,6 +15962,7 @@ const Simulation = () => {
15963
15962
  const colorScheme = hooks.useColorScheme();
15964
15963
  const showcaseMode = location.search.includes("showcase=true");
15965
15964
  React.useEffect(() => {
15965
+ setLocalStorage("Logs", []);
15966
15966
  n((engine) => __awaiter(void 0, void 0, void 0, function* () { return yield loadFull(engine); }));
15967
15967
  // @ts-ignore
15968
15968
  window.showDownload = () => {
package/dist/esm/index.js CHANGED
@@ -458,7 +458,7 @@ const useLocalStorage = ({ key, defaultValue, }) => {
458
458
  if (typeof newValue === "function") {
459
459
  newValue = newValue(value);
460
460
  }
461
- if (newValue) {
461
+ if (newValue !== undefined) {
462
462
  localStorage.setItem(key, JSON.stringify(newValue));
463
463
  window.dispatchEvent(new StorageEvent("storage", {
464
464
  key,
@@ -2519,7 +2519,7 @@ const RunSimulationBlock = () => {
2519
2519
  const run = () => {
2520
2520
  // @ts-ignore
2521
2521
  window._isSimulationFromFile = false;
2522
- navigate(`/simulation/${map.replaceAll(" ", "-")}/${playerBots.join("-")}?seed=${seed}`);
2522
+ navigate(`/simulation/${map.replaceAll(" ", "-")}/${playerBots.join("-")}?seed=${seed === "-" ? "" : seed}`);
2523
2523
  };
2524
2524
  const startRunNoUI = () => {
2525
2525
  setRunningNoUI(true);
@@ -15881,7 +15881,6 @@ const LogViewer = ({ playerNames }) => {
15881
15881
  defaultValue: [],
15882
15882
  });
15883
15883
  useEffect(() => {
15884
- setLogs([]);
15885
15884
  setShowLogs(playerNames.map(() => true));
15886
15885
  }, [playerNames]);
15887
15886
  useEffect(() => {
@@ -15961,6 +15960,7 @@ const Simulation = () => {
15961
15960
  const colorScheme = useColorScheme();
15962
15961
  const showcaseMode = location.search.includes("showcase=true");
15963
15962
  useEffect(() => {
15963
+ setLocalStorage("Logs", []);
15964
15964
  n((engine) => __awaiter(void 0, void 0, void 0, function* () { return yield loadFull(engine); }));
15965
15965
  // @ts-ignore
15966
15966
  window.showDownload = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "code-battles",
3
- "version": "1.5.6",
3
+ "version": "1.5.7",
4
4
  "description": "A library for building interactive competitive coding battles",
5
5
  "repository": "https://github.com/noamzaks/code-battles",
6
6
  "homepage": "https://code-battles.readthedocs.org",