mistercrunch commented on a change in pull request #6519: [RfC] Fix URL too long
URL: 
https://github.com/apache/incubator-superset/pull/6519#discussion_r242670644
 
 

 ##########
 File path: superset/assets/src/explore/exploreUtils.js
 ##########
 @@ -40,19 +42,31 @@ export function getURIDirectory(formData, endpointType = 
'base') {
   return directory;
 }
 
-export function getExploreLongUrl(formData, endpointType) {
+export function getExploreLongUrl(formData, endpointType, allowOverflow = 
true, extraSearch = {}) {
   if (!formData.datasource) {
     return null;
   }
 
   const uri = new URI('/');
   const directory = getURIDirectory(formData, endpointType);
   const search = uri.search(true);
+  Object.keys(extraSearch).forEach((key) => {
+    search[key] = extraSearch[key];
+  });
   search.form_data = JSON.stringify(formData);
   if (endpointType === 'standalone') {
     search.standalone = 'true';
   }
-  return uri.directory(directory).search(search).toString();
+  const url = uri.directory(directory).search(search).toString();
+  if (!allowOverflow && url.length > MAX_URL_LENGTH) {
+    const minimalFormData = {
 
 Review comment:
   Nah that's falling back on specifying only the datasource and viz_type. 
Basically the URL in the browser is shortened but looses most of the state. The 
shortner still behaves as expected though.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to