|
@@ -228,8 +228,8 @@ export const applyEvent = async (event, socket) => {
|
|
a.href = eval?.(
|
|
a.href = eval?.(
|
|
event.payload.url.replace(
|
|
event.payload.url.replace(
|
|
"getBackendURL(env.UPLOAD)",
|
|
"getBackendURL(env.UPLOAD)",
|
|
- `"${getBackendURL(env.UPLOAD)}"`
|
|
|
|
- )
|
|
|
|
|
|
+ `"${getBackendURL(env.UPLOAD)}"`,
|
|
|
|
+ ),
|
|
);
|
|
);
|
|
}
|
|
}
|
|
a.download = event.payload.filename;
|
|
a.download = event.payload.filename;
|
|
@@ -342,7 +342,7 @@ export const applyRestEvent = async (event, socket) => {
|
|
event.payload.files,
|
|
event.payload.files,
|
|
event.payload.upload_id,
|
|
event.payload.upload_id,
|
|
event.payload.on_upload_progress,
|
|
event.payload.on_upload_progress,
|
|
- socket
|
|
|
|
|
|
+ socket,
|
|
);
|
|
);
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
@@ -419,7 +419,7 @@ export const connect = async (
|
|
dispatch,
|
|
dispatch,
|
|
transports,
|
|
transports,
|
|
setConnectErrors,
|
|
setConnectErrors,
|
|
- client_storage = {}
|
|
|
|
|
|
+ client_storage = {},
|
|
) => {
|
|
) => {
|
|
// Get backend URL object from the endpoint.
|
|
// Get backend URL object from the endpoint.
|
|
const endpoint = getBackendURL(EVENTURL);
|
|
const endpoint = getBackendURL(EVENTURL);
|
|
@@ -509,7 +509,7 @@ export const connect = async (
|
|
for (const substate in update.delta) {
|
|
for (const substate in update.delta) {
|
|
const new_substate_info = getSubstateFromUpdate(
|
|
const new_substate_info = getSubstateFromUpdate(
|
|
update.delta[substate],
|
|
update.delta[substate],
|
|
- substate
|
|
|
|
|
|
+ substate,
|
|
);
|
|
);
|
|
if (new_substate_info === null) {
|
|
if (new_substate_info === null) {
|
|
console.error("Received patch out of order", update.delta[substate]);
|
|
console.error("Received patch out of order", update.delta[substate]);
|
|
@@ -525,7 +525,7 @@ export const connect = async (
|
|
event_processing = !update.final;
|
|
event_processing = !update.final;
|
|
if (failed_substates.length > 0) {
|
|
if (failed_substates.length > 0) {
|
|
update.events.push(
|
|
update.events.push(
|
|
- Event(state_name + ".partial_hydrate", { states: failed_substates })
|
|
|
|
|
|
+ Event(state_name + ".partial_hydrate", { states: failed_substates }),
|
|
);
|
|
);
|
|
}
|
|
}
|
|
if (update.events) {
|
|
if (update.events) {
|
|
@@ -556,7 +556,7 @@ export const uploadFiles = async (
|
|
files,
|
|
files,
|
|
upload_id,
|
|
upload_id,
|
|
on_upload_progress,
|
|
on_upload_progress,
|
|
- socket
|
|
|
|
|
|
+ socket,
|
|
) => {
|
|
) => {
|
|
// return if there's no file to upload
|
|
// return if there's no file to upload
|
|
if (files === undefined || files.length === 0) {
|
|
if (files === undefined || files.length === 0) {
|
|
@@ -661,7 +661,7 @@ export const Event = (
|
|
name,
|
|
name,
|
|
payload = {},
|
|
payload = {},
|
|
event_actions = {},
|
|
event_actions = {},
|
|
- handler = null
|
|
|
|
|
|
+ handler = null,
|
|
) => {
|
|
) => {
|
|
return { name, payload, handler, event_actions };
|
|
return { name, payload, handler, event_actions };
|
|
};
|
|
};
|
|
@@ -688,7 +688,7 @@ export const hydrateClientStorage = (client_storage) => {
|
|
for (const state_key in client_storage.local_storage) {
|
|
for (const state_key in client_storage.local_storage) {
|
|
const options = client_storage.local_storage[state_key];
|
|
const options = client_storage.local_storage[state_key];
|
|
const local_storage_value = localStorage.getItem(
|
|
const local_storage_value = localStorage.getItem(
|
|
- options.name || state_key
|
|
|
|
|
|
+ options.name || state_key,
|
|
);
|
|
);
|
|
if (local_storage_value !== null) {
|
|
if (local_storage_value !== null) {
|
|
client_storage_values[state_key] = local_storage_value;
|
|
client_storage_values[state_key] = local_storage_value;
|
|
@@ -699,7 +699,7 @@ export const hydrateClientStorage = (client_storage) => {
|
|
for (const state_key in client_storage.session_storage) {
|
|
for (const state_key in client_storage.session_storage) {
|
|
const session_options = client_storage.session_storage[state_key];
|
|
const session_options = client_storage.session_storage[state_key];
|
|
const session_storage_value = sessionStorage.getItem(
|
|
const session_storage_value = sessionStorage.getItem(
|
|
- session_options.name || state_key
|
|
|
|
|
|
+ session_options.name || state_key,
|
|
);
|
|
);
|
|
if (session_storage_value != null) {
|
|
if (session_storage_value != null) {
|
|
client_storage_values[state_key] = session_storage_value;
|
|
client_storage_values[state_key] = session_storage_value;
|
|
@@ -724,7 +724,7 @@ export const hydrateClientStorage = (client_storage) => {
|
|
const applyClientStorageDelta = (client_storage, delta) => {
|
|
const applyClientStorageDelta = (client_storage, delta) => {
|
|
// find the main state and check for is_hydrated
|
|
// find the main state and check for is_hydrated
|
|
const unqualified_states = Object.keys(delta).filter(
|
|
const unqualified_states = Object.keys(delta).filter(
|
|
- (key) => key.split(".").length === 1
|
|
|
|
|
|
+ (key) => key.split(".").length === 1,
|
|
);
|
|
);
|
|
if (unqualified_states.length === 1) {
|
|
if (unqualified_states.length === 1) {
|
|
const main_state = delta[unqualified_states[0]];
|
|
const main_state = delta[unqualified_states[0]];
|
|
@@ -758,7 +758,7 @@ const applyClientStorageDelta = (client_storage, delta) => {
|
|
const session_options = client_storage.session_storage[state_key];
|
|
const session_options = client_storage.session_storage[state_key];
|
|
sessionStorage.setItem(
|
|
sessionStorage.setItem(
|
|
session_options.name || state_key,
|
|
session_options.name || state_key,
|
|
- delta[substate][key]
|
|
|
|
|
|
+ delta[substate][key],
|
|
);
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -778,7 +778,7 @@ const applyClientStorageDelta = (client_storage, delta) => {
|
|
export const useEventLoop = (
|
|
export const useEventLoop = (
|
|
dispatch,
|
|
dispatch,
|
|
initial_events = () => [],
|
|
initial_events = () => [],
|
|
- client_storage = {}
|
|
|
|
|
|
+ client_storage = {},
|
|
) => {
|
|
) => {
|
|
const socket = useRef(null);
|
|
const socket = useRef(null);
|
|
const router = useRouter();
|
|
const router = useRouter();
|
|
@@ -792,7 +792,7 @@ export const useEventLoop = (
|
|
|
|
|
|
event_actions = events.reduce(
|
|
event_actions = events.reduce(
|
|
(acc, e) => ({ ...acc, ...e.event_actions }),
|
|
(acc, e) => ({ ...acc, ...e.event_actions }),
|
|
- event_actions ?? {}
|
|
|
|
|
|
+ event_actions ?? {},
|
|
);
|
|
);
|
|
|
|
|
|
const _e = args.filter((o) => o?.preventDefault !== undefined)[0];
|
|
const _e = args.filter((o) => o?.preventDefault !== undefined)[0];
|
|
@@ -820,7 +820,7 @@ export const useEventLoop = (
|
|
debounce(
|
|
debounce(
|
|
combined_name,
|
|
combined_name,
|
|
() => queueEvents(events, socket),
|
|
() => queueEvents(events, socket),
|
|
- event_actions.debounce
|
|
|
|
|
|
+ event_actions.debounce,
|
|
);
|
|
);
|
|
} else {
|
|
} else {
|
|
queueEvents(events, socket);
|
|
queueEvents(events, socket);
|
|
@@ -886,7 +886,7 @@ export const useEventLoop = (
|
|
dispatch,
|
|
dispatch,
|
|
["websocket"],
|
|
["websocket"],
|
|
setConnectErrors,
|
|
setConnectErrors,
|
|
- client_storage
|
|
|
|
|
|
+ client_storage,
|
|
);
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -935,7 +935,7 @@ export const useEventLoop = (
|
|
vars[storage_to_state_map[e.key]] = e.newValue;
|
|
vars[storage_to_state_map[e.key]] = e.newValue;
|
|
const event = Event(
|
|
const event = Event(
|
|
`${state_name}.reflex___state____update_vars_internal_state.update_vars_internal`,
|
|
`${state_name}.reflex___state____update_vars_internal_state.update_vars_internal`,
|
|
- { vars: vars }
|
|
|
|
|
|
+ { vars: vars },
|
|
);
|
|
);
|
|
addEvents([event], e);
|
|
addEvents([event], e);
|
|
}
|
|
}
|
|
@@ -1028,7 +1028,7 @@ export const getRefValues = (refs) => {
|
|
return refs.map((ref) =>
|
|
return refs.map((ref) =>
|
|
ref.current
|
|
ref.current
|
|
? ref.current.value || ref.current.getAttribute("aria-valuenow")
|
|
? ref.current.value || ref.current.getAttribute("aria-valuenow")
|
|
- : null
|
|
|
|
|
|
+ : null,
|
|
);
|
|
);
|
|
};
|
|
};
|
|
|
|
|